AsyncHttpServer

Overview

The AsyncHttpServer class provides implements asynchronous version of Http server.

Location

 

constructor

Creates a new instance of the AsyncHttpServer class.

 

constructor

 

AsyncHttpServer()

 

Sub New()

constructor (IContainer)

Creates a new instance of the AsyncHttpServer class and adds it to the provided components collection.

 

constructor(container: IContainer)

 

AsyncHttpServer(IContainer container)

 

Sub New(container As IContainer)

Parameters:

  • container: Components collection

Active    (declared in Server)

Gets or sets the flag defining whether the server is listening for incoming connections.

Setting this property to true or false calls the Open or Close methods, accordingly

 

property Active: Boolean read write;

 

Boolean Active { get; set; }

 

Property Active() As Boolean

BeforeHaveData

This event is raised before the data received from the client are processed. Can be used to adjust, validate and/or log client requests.

 

event BeforeHaveData: EventHandler<AsyncHttpRequestEventArgs>;

 

delegate EventHandler<AsyncHttpRequestEventArgs> BeforeHaveData()

 

Event BeforeHaveData As EventHandler<AsyncHttpRequestEventArgs>

BindAddressV4    (declared in Server)

 

property BindAddressV4: IPAddress read write;

 

IPAddress BindAddressV4 { get; set; }

 

Property BindAddressV4() As IPAddress

BindAddressV6    (declared in Server)

 

property BindAddressV6: IPAddress read write;

 

IPAddress BindAddressV6 { get; set; }

 

Property BindAddressV6() As IPAddress

BindingV4    (declared in Server)

Gets the IPv4 ServerBinding instance.

The returned instance can be used to fine-tune the IPv4 server endpoint.

 

property BindingV4: ServerBinding read;

 

ServerBinding BindingV4 { get; }

 

ReadOnly Property BindingV4() As ServerBinding

BindingV6    (declared in Server)

Gets the IPv6 ServerBinding instance.

The returned instance can be used to fine-tune the IPv6 server endpoint.

 

property BindingV6: ServerBinding read;

 

ServerBinding BindingV6 { get; }

 

ReadOnly Property BindingV6() As ServerBinding

BindV4    (declared in Server)

Gets or sets the flag indicating whether the server should listen for IPv4 connections.

Setting this flag doesn't have any immediate effect. Its value is used only when the server is opened (either by setting the Active property to true or by directly calling the Open method).

 

property BindV4: Boolean read write;

 

Boolean BindV4 { get; set; }

 

Property BindV4() As Boolean

BindV6    (declared in Server)

Gets or sets the flag indicating whether the server should listen for IPv6 connections.

Setting this flag doesn't have any immediate effect. Its value is used only when the server is opened (either by setting the Active property to true or by directly calling the Open method).

 

property BindV6: Boolean read write;

 

Boolean BindV6 { get; set; }

 

Property BindV6() As Boolean

ClientClosed    (declared in AsyncServer)

 

method ClientClosed(worker: IAsyncWorker)

 

void ClientClosed(IAsyncWorker worker)

 

Sub ClientClosed(worker As IAsyncWorker)

Parameters:

  • worker:

Close    (declared in AsyncServer)

Inherited from [Server](/API/NET/Classes/Server/). This method causes the server to stop listening for all connections. You may use the Active property to test for success.

 

method Close

 

void Close()

 

Sub Close()

CloseConnectionsOnShutdown    (declared in Server)

Gets or sets the flag indicating whether the currently open client connections should be appropriately closed on server shutdown.

The default value is true.

 

property CloseConnectionsOnShutdown: Boolean read write;

 

Boolean CloseConnectionsOnShutdown { get; set; }

 

Property CloseConnectionsOnShutdown() As Boolean

ConnectionClass    (declared in Server)

Gets or sets an alternative Connection class to be used for incoming data connections. The class described by the assigned Type must be a descendant of the Connection class, and will be used for all connections that are established after the property has been set.

Existing connections are not affected by changing the property.

If the ConnectionType property value is null (default), instances of the Connection base class will be used.

 

property ConnectionClass: Type read write;

 

Type ConnectionClass { get; set; }

 

Property ConnectionClass() As Type

ConnectionFactory    (declared in Server)

Gets or sets an alternative Connection factory instance to be used for incoming data connections. This factory will be used to create corresponding Connection instances for all connections that are established after the property has been set.

Existing connections are not affected by changing the property.

This property has precendence over the ConnectionClass property.

 

property ConnectionFactory: IConnectionFactory read write;

 

IConnectionFactory ConnectionFactory { get; set; }

 

Property ConnectionFactory() As IConnectionFactory

CreateWorker  protected

 

method CreateWorker(owner: Server): Object

 

Object CreateWorker(Server owner)

 

Function CreateWorker(owner As Server) As Object

Parameters:

  • owner:

DefaultPort  protected    (declared in Server)

Gets or sets the default port number.

 

property DefaultPort: Int32 read write;

 

Int32 DefaultPort { get; set; }

 

Property DefaultPort() As Int32

Dispose  protected    (declared in Server)

Disposes of the current instance and releases all resources used by it.

 

method Dispose(disposing: Boolean)

 

void Dispose(Boolean disposing)

 

Sub Dispose(disposing As Boolean)

Parameters:

  • disposing:

EnableNagle    (declared in Server)

Gets or the sets flag indicating whether the Nagle's algoritm should be used.

Setting this flag doesn't have any immediate effect. Its value is used only when the server is opened (either by setting the Active property to true or by directly calling the Open method).

 

property EnableNagle: Boolean read write;

 

Boolean EnableNagle { get; set; }

 

Property EnableNagle() As Boolean

HttpRequest

This event is raised for an incoming request and allows the user code to provide custom handling for this request.

 

event HttpRequest: EventHandler<AsyncHttpRequestEventArgs>;

 

delegate EventHandler<AsyncHttpRequestEventArgs> HttpRequest()

 

Event HttpRequest As EventHandler<AsyncHttpRequestEventArgs>

HttpResponseFailed

This event is fired when the response sending fails.

 

event HttpResponseFailed: EventHandler<AsyncHttpRequestEventArgs>;

 

delegate EventHandler<AsyncHttpRequestEventArgs> HttpResponseFailed()

 

Event HttpResponseFailed As EventHandler<AsyncHttpRequestEventArgs>

HttpResponseSent

This event is fired after the response was successfully sent to the client.

 

event HttpResponseSent: EventHandler<AsyncHttpRequestEventArgs>;

 

delegate EventHandler<AsyncHttpRequestEventArgs> HttpResponseSent()

 

Event HttpResponseSent As EventHandler<AsyncHttpRequestEventArgs>

IsRunningOnMono  protected    (declared in Server)

 

class method IsRunningOnMono: Boolean

 

static Boolean IsRunningOnMono()

 

Shared Function IsRunningOnMono() As Boolean

KeepAlive

Controls whether to use HTTP Keep-Alive to keep the connection alive between requests.

If enabled (true), once a request is made and a connection is established, this connection is kept open and used for future requests. If disabled, the connection is closed and a new connection is created for future requests.

Since establishing a connection is - relatively speaking - a costly and resource intensive operation for the network, compared to sending small amounts of data, it is recommended to keep this option enabled for optimal performance, if requests to the server are sent frequently. For Keep-Alive to work, the option must be supported and enabled on both client and server.

 

property KeepAlive: Boolean read write;

 

Boolean KeepAlive { get; set; }

 

Property KeepAlive() As Boolean

MaxLineLength    (declared in Server)

Gets or sets the default MaxLineLength value for all newly created Connections.

See the desription of the Connection.MaxLineLength property for details.

 

property MaxLineLength: Int32 read write;

 

Int32 MaxLineLength { get; set; }

 

Property MaxLineLength() As Int32

MaxLineLengthEnabled    (declared in Server)

Gets or sets the default MaxLineLengthEnabled value for all newly created Connections.

See the desription of the Connection.MaxLineLengthEnabled property for details.

 

property MaxLineLengthEnabled: Boolean read write;

 

Boolean MaxLineLengthEnabled { get; set; }

 

Property MaxLineLengthEnabled() As Boolean

MaxPostSize

Determines the maximum length of client's request data (checks the value of the request Content-Length header). By default, this property equals 4MB.

 

property MaxPostSize: Int32 read write;

 

Int32 MaxPostSize { get; set; }

 

Property MaxPostSize() As Int32

NewContext  protected

Returns new request context for the provided async worker.

 

method NewContext(worker: AsyncHttpServerWorker): AsyncHttpContext

 

AsyncHttpContext NewContext(AsyncHttpServerWorker worker)

 

Function NewContext(worker As AsyncHttpServerWorker) As AsyncHttpContext

Parameters:

  • worker: Async worker that will be contained in the generated context

Open    (declared in AsyncServer)

Inherited from [Server](/API/NET/Classes/Server/). This method causes the server to start listening for connections. You may use the Active property to test for success.

 

method Open

 

void Open()

 

Sub Open()

Port    (declared in Server)

Gets or sets the port number on which the server will listen.

 

property Port: Int32 read write;

 

Int32 Port { get; set; }

 

Property Port() As Int32

ServerName

Gets or sets name of the server sent to the client.

The default value is Remoting SDK HTTP Server.

 

property ServerName: String read write;

 

String ServerName { get; set; }

 

Property ServerName() As String

ShouldSerializePort    (declared in Server)

Returns true when the DefaultPort is not equal to the Port.

 

method ShouldSerializePort: Boolean

 

Boolean ShouldSerializePort()

 

Function ShouldSerializePort() As Boolean

SslOptions    (declared in Server)

Gets the SslConnectionFactory instance that can be used to configure the SSL options of the current Server instance.

 

property SslOptions: SslConnectionFactory read;

 

SslConnectionFactory SslOptions { get; }

 

ReadOnly Property SslOptions() As SslConnectionFactory

Timeout    (declared in Server)

Gets or sets the default Timeout value for all newly created Connections.

See the desription of the Connection.Timeout property for details.

 

property Timeout: Int32 read write;

 

Int32 Timeout { get; set; }

 

Property Timeout() As Int32

TimeoutEnabled    (declared in Server)

Gets or sets the default TimeoutEnabled value for all newly created Connections.

See the desription of the Connection.TimeoutEnabled property for details.

 

property TimeoutEnabled: Boolean read write;

 

Boolean TimeoutEnabled { get; set; }

 

Property TimeoutEnabled() As Boolean

TriggerBeforeHaveData  protected

Triggers the BeforeHaveData event.

 

method TriggerBeforeHaveData(e: AsyncHttpRequestEventArgs)

 

void TriggerBeforeHaveData(AsyncHttpRequestEventArgs e)

 

Sub TriggerBeforeHaveData(e As AsyncHttpRequestEventArgs)

Parameters:

  • e: Event arguments

TriggerHttpRequest  protected

Triggers the HttpRequest event.

 

method TriggerHttpRequest(e: AsyncHttpRequestEventArgs)

 

void TriggerHttpRequest(AsyncHttpRequestEventArgs e)

 

Sub TriggerHttpRequest(e As AsyncHttpRequestEventArgs)

Parameters:

  • e: Event arguments

TriggerHttpResponseFailed  protected

Triggers the HttpResponseFailed event.

 

method TriggerHttpResponseFailed(e: AsyncHttpRequestEventArgs)

 

void TriggerHttpResponseFailed(AsyncHttpRequestEventArgs e)

 

Sub TriggerHttpResponseFailed(e As AsyncHttpRequestEventArgs)

Parameters:

  • e: Event arguments

TriggerHttpResponseSent  protected

Triggers the HttpResponseSent event.

 

method TriggerHttpResponseSent(e: AsyncHttpRequestEventArgs)

 

void TriggerHttpResponseSent(AsyncHttpRequestEventArgs e)

 

Sub TriggerHttpResponseSent(e As AsyncHttpRequestEventArgs)

Parameters:

  • e: Event arguments

ValidateRequests

Gets or sets a flag indicating whether incoming requests should be validated prior to be handled.

Note: This property is not used directly in the AsyncHttpServer class. It is up to the user code to implement needed validation calls.

 

property ValidateRequests: Boolean read write;

 

Boolean ValidateRequests { get; set; }

 

Property ValidateRequests() As Boolean

 

Active    (declared in Server)

Gets or sets the flag defining whether the server is listening for incoming connections.

Setting this property to true or false calls the Open or Close methods, accordingly

 

property Active: Boolean read write;

 

Boolean Active { get; set; }

 

Property Active() As Boolean

BindAddressV4    (declared in Server)

 

property BindAddressV4: IPAddress read write;

 

IPAddress BindAddressV4 { get; set; }

 

Property BindAddressV4() As IPAddress

BindAddressV6    (declared in Server)

 

property BindAddressV6: IPAddress read write;

 

IPAddress BindAddressV6 { get; set; }

 

Property BindAddressV6() As IPAddress

BindingV4    (declared in Server)

Gets the IPv4 ServerBinding instance.

The returned instance can be used to fine-tune the IPv4 server endpoint.

 

property BindingV4: ServerBinding read;

 

ServerBinding BindingV4 { get; }

 

ReadOnly Property BindingV4() As ServerBinding

BindingV6    (declared in Server)

Gets the IPv6 ServerBinding instance.

The returned instance can be used to fine-tune the IPv6 server endpoint.

 

property BindingV6: ServerBinding read;

 

ServerBinding BindingV6 { get; }

 

ReadOnly Property BindingV6() As ServerBinding

BindV4    (declared in Server)

Gets or sets the flag indicating whether the server should listen for IPv4 connections.

Setting this flag doesn't have any immediate effect. Its value is used only when the server is opened (either by setting the Active property to true or by directly calling the Open method).

 

property BindV4: Boolean read write;

 

Boolean BindV4 { get; set; }

 

Property BindV4() As Boolean

BindV6    (declared in Server)

Gets or sets the flag indicating whether the server should listen for IPv6 connections.

Setting this flag doesn't have any immediate effect. Its value is used only when the server is opened (either by setting the Active property to true or by directly calling the Open method).

 

property BindV6: Boolean read write;

 

Boolean BindV6 { get; set; }

 

Property BindV6() As Boolean

CloseConnectionsOnShutdown    (declared in Server)

Gets or sets the flag indicating whether the currently open client connections should be appropriately closed on server shutdown.

The default value is true.

 

property CloseConnectionsOnShutdown: Boolean read write;

 

Boolean CloseConnectionsOnShutdown { get; set; }

 

Property CloseConnectionsOnShutdown() As Boolean

ConnectionClass    (declared in Server)

Gets or sets an alternative Connection class to be used for incoming data connections. The class described by the assigned Type must be a descendant of the Connection class, and will be used for all connections that are established after the property has been set.

Existing connections are not affected by changing the property.

If the ConnectionType property value is null (default), instances of the Connection base class will be used.

 

property ConnectionClass: Type read write;

 

Type ConnectionClass { get; set; }

 

Property ConnectionClass() As Type

ConnectionFactory    (declared in Server)

Gets or sets an alternative Connection factory instance to be used for incoming data connections. This factory will be used to create corresponding Connection instances for all connections that are established after the property has been set.

Existing connections are not affected by changing the property.

This property has precendence over the ConnectionClass property.

 

property ConnectionFactory: IConnectionFactory read write;

 

IConnectionFactory ConnectionFactory { get; set; }

 

Property ConnectionFactory() As IConnectionFactory

DefaultPort  protected    (declared in Server)

Gets or sets the default port number.

 

property DefaultPort: Int32 read write;

 

Int32 DefaultPort { get; set; }

 

Property DefaultPort() As Int32

EnableNagle    (declared in Server)

Gets or the sets flag indicating whether the Nagle's algoritm should be used.

Setting this flag doesn't have any immediate effect. Its value is used only when the server is opened (either by setting the Active property to true or by directly calling the Open method).

 

property EnableNagle: Boolean read write;

 

Boolean EnableNagle { get; set; }

 

Property EnableNagle() As Boolean

KeepAlive

Controls whether to use HTTP Keep-Alive to keep the connection alive between requests.

If enabled (true), once a request is made and a connection is established, this connection is kept open and used for future requests. If disabled, the connection is closed and a new connection is created for future requests.

Since establishing a connection is - relatively speaking - a costly and resource intensive operation for the network, compared to sending small amounts of data, it is recommended to keep this option enabled for optimal performance, if requests to the server are sent frequently. For Keep-Alive to work, the option must be supported and enabled on both client and server.

 

property KeepAlive: Boolean read write;

 

Boolean KeepAlive { get; set; }

 

Property KeepAlive() As Boolean

MaxLineLength    (declared in Server)

Gets or sets the default MaxLineLength value for all newly created Connections.

See the desription of the Connection.MaxLineLength property for details.

 

property MaxLineLength: Int32 read write;

 

Int32 MaxLineLength { get; set; }

 

Property MaxLineLength() As Int32

MaxLineLengthEnabled    (declared in Server)

Gets or sets the default MaxLineLengthEnabled value for all newly created Connections.

See the desription of the Connection.MaxLineLengthEnabled property for details.

 

property MaxLineLengthEnabled: Boolean read write;

 

Boolean MaxLineLengthEnabled { get; set; }

 

Property MaxLineLengthEnabled() As Boolean

MaxPostSize

Determines the maximum length of client's request data (checks the value of the request Content-Length header). By default, this property equals 4MB.

 

property MaxPostSize: Int32 read write;

 

Int32 MaxPostSize { get; set; }

 

Property MaxPostSize() As Int32

Port    (declared in Server)

Gets or sets the port number on which the server will listen.

 

property Port: Int32 read write;

 

Int32 Port { get; set; }

 

Property Port() As Int32

ServerName

Gets or sets name of the server sent to the client.

The default value is Remoting SDK HTTP Server.

 

property ServerName: String read write;

 

String ServerName { get; set; }

 

Property ServerName() As String

SslOptions    (declared in Server)

Gets the SslConnectionFactory instance that can be used to configure the SSL options of the current Server instance.

 

property SslOptions: SslConnectionFactory read;

 

SslConnectionFactory SslOptions { get; }

 

ReadOnly Property SslOptions() As SslConnectionFactory

Timeout    (declared in Server)

Gets or sets the default Timeout value for all newly created Connections.

See the desription of the Connection.Timeout property for details.

 

property Timeout: Int32 read write;

 

Int32 Timeout { get; set; }

 

Property Timeout() As Int32

TimeoutEnabled    (declared in Server)

Gets or sets the default TimeoutEnabled value for all newly created Connections.

See the desription of the Connection.TimeoutEnabled property for details.

 

property TimeoutEnabled: Boolean read write;

 

Boolean TimeoutEnabled { get; set; }

 

Property TimeoutEnabled() As Boolean

ValidateRequests

Gets or sets a flag indicating whether incoming requests should be validated prior to be handled.

Note: This property is not used directly in the AsyncHttpServer class. It is up to the user code to implement needed validation calls.

 

property ValidateRequests: Boolean read write;

 

Boolean ValidateRequests { get; set; }

 

Property ValidateRequests() As Boolean

 

IsRunningOnMono  protected    (declared in Server)

 

class method IsRunningOnMono: Boolean

 

static Boolean IsRunningOnMono()

 

Shared Function IsRunningOnMono() As Boolean

 

constructor

Creates a new instance of the AsyncHttpServer class.

 

constructor

 

AsyncHttpServer()

 

Sub New()

constructor (IContainer)

Creates a new instance of the AsyncHttpServer class and adds it to the provided components collection.

 

constructor(container: IContainer)

 

AsyncHttpServer(IContainer container)

 

Sub New(container As IContainer)

Parameters:

  • container: Components collection

ClientClosed    (declared in AsyncServer)

 

method ClientClosed(worker: IAsyncWorker)

 

void ClientClosed(IAsyncWorker worker)

 

Sub ClientClosed(worker As IAsyncWorker)

Parameters:

  • worker:

Close    (declared in AsyncServer)

Inherited from [Server](/API/NET/Classes/Server/). This method causes the server to stop listening for all connections. You may use the Active property to test for success.

 

method Close

 

void Close()

 

Sub Close()

CreateWorker  protected

 

method CreateWorker(owner: Server): Object

 

Object CreateWorker(Server owner)

 

Function CreateWorker(owner As Server) As Object

Parameters:

  • owner:

Dispose  protected    (declared in Server)

Disposes of the current instance and releases all resources used by it.

 

method Dispose(disposing: Boolean)

 

void Dispose(Boolean disposing)

 

Sub Dispose(disposing As Boolean)

Parameters:

  • disposing:

NewContext  protected

Returns new request context for the provided async worker.

 

method NewContext(worker: AsyncHttpServerWorker): AsyncHttpContext

 

AsyncHttpContext NewContext(AsyncHttpServerWorker worker)

 

Function NewContext(worker As AsyncHttpServerWorker) As AsyncHttpContext

Parameters:

  • worker: Async worker that will be contained in the generated context

Open    (declared in AsyncServer)

Inherited from [Server](/API/NET/Classes/Server/). This method causes the server to start listening for connections. You may use the Active property to test for success.

 

method Open

 

void Open()

 

Sub Open()

ShouldSerializePort    (declared in Server)

Returns true when the DefaultPort is not equal to the Port.

 

method ShouldSerializePort: Boolean

 

Boolean ShouldSerializePort()

 

Function ShouldSerializePort() As Boolean

TriggerBeforeHaveData  protected

Triggers the BeforeHaveData event.

 

method TriggerBeforeHaveData(e: AsyncHttpRequestEventArgs)

 

void TriggerBeforeHaveData(AsyncHttpRequestEventArgs e)

 

Sub TriggerBeforeHaveData(e As AsyncHttpRequestEventArgs)

Parameters:

  • e: Event arguments

TriggerHttpRequest  protected

Triggers the HttpRequest event.

 

method TriggerHttpRequest(e: AsyncHttpRequestEventArgs)

 

void TriggerHttpRequest(AsyncHttpRequestEventArgs e)

 

Sub TriggerHttpRequest(e As AsyncHttpRequestEventArgs)

Parameters:

  • e: Event arguments

TriggerHttpResponseFailed  protected

Triggers the HttpResponseFailed event.

 

method TriggerHttpResponseFailed(e: AsyncHttpRequestEventArgs)

 

void TriggerHttpResponseFailed(AsyncHttpRequestEventArgs e)

 

Sub TriggerHttpResponseFailed(e As AsyncHttpRequestEventArgs)

Parameters:

  • e: Event arguments

TriggerHttpResponseSent  protected

Triggers the HttpResponseSent event.

 

method TriggerHttpResponseSent(e: AsyncHttpRequestEventArgs)

 

void TriggerHttpResponseSent(AsyncHttpRequestEventArgs e)

 

Sub TriggerHttpResponseSent(e As AsyncHttpRequestEventArgs)

Parameters:

  • e: Event arguments

 

BeforeHaveData

This event is raised before the data received from the client are processed. Can be used to adjust, validate and/or log client requests.

 

event BeforeHaveData: EventHandler<AsyncHttpRequestEventArgs>;

 

delegate EventHandler<AsyncHttpRequestEventArgs> BeforeHaveData()

 

Event BeforeHaveData As EventHandler<AsyncHttpRequestEventArgs>

HttpRequest

This event is raised for an incoming request and allows the user code to provide custom handling for this request.

 

event HttpRequest: EventHandler<AsyncHttpRequestEventArgs>;

 

delegate EventHandler<AsyncHttpRequestEventArgs> HttpRequest()

 

Event HttpRequest As EventHandler<AsyncHttpRequestEventArgs>

HttpResponseFailed

This event is fired when the response sending fails.

 

event HttpResponseFailed: EventHandler<AsyncHttpRequestEventArgs>;

 

delegate EventHandler<AsyncHttpRequestEventArgs> HttpResponseFailed()

 

Event HttpResponseFailed As EventHandler<AsyncHttpRequestEventArgs>

HttpResponseSent

This event is fired after the response was successfully sent to the client.

 

event HttpResponseSent: EventHandler<AsyncHttpRequestEventArgs>;

 

delegate EventHandler<AsyncHttpRequestEventArgs> HttpResponseSent()

 

Event HttpResponseSent As EventHandler<AsyncHttpRequestEventArgs>