Internet Direct (Indy)
Home
PreviousUpNext
TIdServerIOHandlerSocket.Accept Method

Creates the IOHandler for the client connection in a multi-threaded server.

Pascal
function Accept(
    ASocket: TIdSocketHandle; 
    AListenerThread: TIdThread; 
    AYarn: TIdYarn
): TIdIOHandler; override;
Parameters 
Description 
ASocket 
Socket descriptor representing the client connection for the IOHandler.
 
AListenerThread 
Server Listener thread that has detected the connection request.
 
AYarn 
Scheduler for the thread/fiber. 

TIdIOHandler - THe IOHandler created for the client connection to the server.

Accept is an overridden TIdIOHandler function used to create a TIdIOHandler instance for threaded client connections to a server. 

ASocket is the socket descriptor representing the client connection for the IOHandler. 

AListenerThread is the Listener thread in the server that has detected the client connection request. 

AYarn is the scheduler for the threaded or fiber-based client connection. 

Accept is called during execution of the listener thread in a multi-thread server when a new threaded client connection is detected. Accept is used to create the managed TIdIOHandler used to read and write to the client connection during execution of the threaded client. 

Accept can return Nil when the connection cannot be accepted or the listenter thread has been stopped. 

Accept uses the IOHandlerSocketClass property to create a new TIdIOHandler instance used for reading from and writing to the threaded client connection. 

Accept calls the TIdIOHandler.Open method for the new instance 

The new TIdIOHandler instance is also used to accept the connection for the socket descriptor in ASocket, and to trigger the AfterAccept method in the instance.

Implementation modified. Assertions added. Needs exception docs.

IOHandlerSocketClass 

TIdListenerThread 

TIdIOHandler

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.