TsgcWebSocketServer_HTTPAPIEvents › OnAsynchronous

OnAsynchronous Event

Fires when an asynchronous send operation initiated by the HTTP API server has completed.

Syntax

public event TsgcWSHTTPAPIAsynchronousEventHandler OnAsynchronous;
// delegate void TsgcWSHTTPAPIAsynchronousEventHandler(TObject Sender, out TsgcHTTPAPIContext aConnection, out bool Handled)

Default Value

Remarks

When the Asynchronous property is True, messages written to a client do not block the calling thread: the IOCP worker queues the send and returns immediately, and HTTP.SYS signals completion later. OnAsynchronous is raised for every completed async operation so the application can release or reuse the underlying buffers. The aConnection parameter points to the TsgcHTTPAPIContext associated with the completed request; set Handled to True when the application has already disposed of the context to prevent the component from running its default cleanup. If Asynchronous is False (the default) this event is never raised.

Example


void OnAsynchronous(TObject Sender, out TsgcHTTPAPIContext aConnection,
  out bool Handled)
{
  DoLog("async write completed");
  aConnection = null;
  Handled = false;
}

Back to Events