Class HttpServerSession
Simple HTTP 1.1 server. Can be used for communicating between two scripts or apps on local network, internet or same computer. Also can receive requests from web browsers etc.
public abstract class HttpServerSession
Remarks
To receive HTTP messages, create a class with base HttpServerSession and add function HttpServerSession.MessageReceived. Example in HttpServerSession.Listen<TSession>.
Namespace: Au.More
Assembly: Au.dll
Inheritance
Properties
| Name | Description |
|---|---|
| Client | Gets the System.Net.Sockets.TcpClient object of this session. |
| ClientIP | Gets the IP address of the client. |
| KeepAliveTimeout | Keep-alive timeout, in milliseconds. Default 10000. |
| Verbose | Print warning when something fails. This is for debug. |
Methods
| Name | Description |
|---|---|
| Auth(Func<string, string, bool>) | Performs basic authentication. If fails (either the client did not use basic authentication or auth returned |
| Listen<TSession>(int, string, Action<TcpListener>) | Simple HTTP 1.1 server. |
| MessageReceived(HSMessage, HSResponse) | Called when the server receives a HTTP request message. |
| Run() | Executes the session: reads requests, calls your HttpServerSession.MessageReceived, writes responses, implements keep-alive. |