Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Class: RT.Servers.HttpServer

Summary

Provides an HTTP server.

Constructors

Constructs an HTTP server with the specified configuration settings.
HttpServer(int port, HttpServerOptions options = null)
Constructs an HTTP server with the specified configuration settings and using the specified port number for unsecured HTTP traffic.

Instance methods

void
HandleConnection(Socket incomingConnection, bool secure)
Handles an incoming connection. This function can be used to let the server handle a TCP connection that was received by some other component outside the HttpServer class. This function may or may not return immediately; some requests may, theoretically, be handled completely synchronously if all the data has already been received and buffered by the OS.
void
StartListening(bool blocking = false)
Runs the HTTP server.
void
StopListening(bool brutal = false, bool blocking = false)
Shuts the HTTP server down.

Instance properties

Func<HttpRequest, Exception, HttpResponse> Specifies a request handler that is invoked whenever HttpServer.Handler throws an exception. (see also remarks)
Func<HttpRequest, HttpResponse> Specifies the HTTP request handler for this server. (see also remarks)
boolGets a value indicating whether the server is currently running (listening).
LoggerBase Gets or sets a logger to log all HTTP requests to. (see also remarks)
HttpServerOptions Gets or sets the configuration settings currently in effect for this server. (see also remarks)
bool Determines whether exceptions in HttpServer.Handler, HttpServer.ErrorHandler and the response stream get propagated to the debugger. Setting this to true will cause exceptions to bring down the server. (see also remarks)
Action<HttpRequest, Exception, HttpResponse> Specifies a method to be invoked whenever an exception occurs while reading from the response stream. (see also remarks)
HttpServer.StatisticsGets an object containing various server performance statistics.

Instance fields

ManualResetEvent Wait on this event after starting the server to be notified of when the server has fully shut down. This event is initially un-signalled; starting the server resets it, stopping the server sets it as soon as the last active connection is terminated. Starting the server again before the previous shutdown is complete will result in this event not being raised at all for the previous shutdown.

Nested types

Keeps track of and exposes getters for various server performance statistics.