Internet Direct (Indy) Version 9.0.1 Beta
TIdSocketHandle.Accept
Accepts a connection on a listening socket.

function Accept(ASocket: TIdStackSocketHandle): boolean;
Parameters
ASocket: TIdStackSocketHandle
Socket descriptor with the connection request.

Description
Accept is a procedure that extracts a pending connection request for a socket descriptor, creates a new socket with the properties of the listening socket, an returns the socket handle of the new socket to Handle.

Accept is used by the listening thread of server applications that spawn new threads for each connection request, like TIdListenerThread and TIdUDPListenerThread.

Accept assigns the new socket descriptor to Handle and sets HandleAllocated to True.

Accept calls UpdateBindingLocal to insure that the protocol stack handler uses the correct protocol family, IP, and Port for servers that may listen on more than one local IP address.

Accept calls UpdateBindingPeer to insure that the protocol stack handler uses the correct protocol family, PeerIP, and PeerPort for the client connection.

If no pending connections are present on the socket descriptor, Accept will wait until a connection is present before exiting from the method.