Indy 9 | Content | Index | Reference

TIdListenerThread
Hierarchy, Properties, Methods, Events, See Also, Unit: IdTCPServer
Listener thread for TCP Servers.

    TIdListenerThread = class(TIdThread)

Unit
IdTCPServer
Description
TIdListenerThread is a thread, based on TIdThread, that listens for client connections. A TIdListenerThread is used by TIdTCPServer, and descendants, to detect new client connection requests and to spawn new TIdPeerThreads for each successful connection to the server.

TIdListenerThread maintains a reference to the server that owns the listening thread, and a list of socket handles that have been accepted by the server. TIdListenerThread also provides a general mechanism to encapsulate the time that the listening thread should wait to accept new socket connection requests.

TIdListenerThread differs from a typical TThread by extending the Execute method to allow access to BeforeRun, Run, and AfterRun methods. In addition, Start and Stop methods are provide allow finer control of thread initialization, resumption, and immediate termination.

TIdListenerThread.Binding
TIdListenerThread, See Also
Represents the socket descriptor used to listen for new client connections.

    property Binding: TIdSocketHandle;

Description
Binding is a TIdSocketHandle property that represents the socket descriptor used by the listener thread to listen for new client connections to the TIdTCPServer.

Binding is initialized in the Create constructor, and contains a socket descriptor allocated for listener threads on the server when it becomes active.

TIdListenerThread.Server
TIdListenerThread, See Also
Server context for the listener thread.

    property Server: TIdTCPServer;

Description
Server is a read-only TIdTCPServer property that provides the server context for the TIdListenerThread. Server is the server context provided for any TIdTCPServerConnection or TIdPeerThread spawned by the TIdListenerThread.

TIdListenerThread.Create
TIdListenerThread, See Also
Constructor for the Listener thread.

    constructor Create(AServer: TIdTCPServer; ABinding: TIdSocketHandle); reintroduce;

Parameters
axServer
Server that owns the listener thread.
Description
Create is the constructor for TIdListenerThread and intializes the class instance.

Create initializes the TList used to store socket handles allocated by the server. Create also sets the Server property to the oner of the listener thread as identified by the parameter axServer.

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