Indy 9 | Content | Index | Reference

TIdServerIOHandlerSocket
Hierarchy, Properties, Methods, Events, Unit: IdServerIOHandlerSocket
Implements socket-based IOHandler support in a multi-threaded server.

    TIdServerIOHandlerSocket = class(TIdServerIOHandler)

Unit
IdServerIOHandlerSocket
Description
TIdServerIOHandlerSocket is a TIdServerIOHandler descendant that implements the framework used in a multi-threaded server to support the Indy socket-based IOHandler framework.

TIdServerIOHandler provides implementations of the Init and Accept methods that allow initialization and realization of a socket-based IOHandler for a multi-threaded server that uses a listening thread to detect client connections.

TIdServerIOHandlerSocket.Accept
TIdServerIOHandlerSocket
Realizes a socket-based IO handler for a threaded client connection.

    function Accept(ASocket: TIdStackSocketHandle; AThread: TIdThread = nil): TIdIOHandler; override;

Parameters
ASocket: TIdStackSocketHandle
Handle for the listener thread detecting the client connection.
Return Value
TIdIOHandler - IO handler to use for the threaded client connection.
Description
Accept is a TIdIOHandler function that allows a multi-thread server to realize a TIdIOHandlerSocket instance using sockets as the input/output source for a threaded client connections.

Accept creates and opens a TIdIOHandlerSocket instance that is used to accept the bind the socket handle provided in ASocket to a client connection.

Accept is called by the listener thread for the multi-thread server when a new threaded client connection is detected. Accept is used to create the TIdIOHandler using the socket handler for the listener thead. The return value is assigned to the TIdTCPConnection.IOHandler in the threaded client connection for subsequent input/output operations.

TIdServerIOHandlerSocket.Init
TIdServerIOHandlerSocket
Initializes the server IO handler for a multi-threaded server.

    procedure Init; override;

Description
Init is a virtual procedure that allows initialization required for the server IOHandler. Init is an empty implementation in TIdServerIOHandlerSocket, and can be overridden in a descendant class to perform maintenance and housekeeping needed for a specific type of input/output source.

Use Accept to realize a TIdIOHandler instance for a socket-based input/output source used for a threaded client connections.

Init is used when a multi-threaded server becomes Active, but prior to allocating socket bindings for any listener threads or client connections.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.