RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomWinSocket.Listen Method

Opens a listening connection for a server socket.

Pascal
procedure Listen(const Name: string; const Address: string; const Service: string; Port: Word; QueueSize: Integer; Block: Boolean = True);
C++
__fastcall Listen(const AnsiString Name, const AnsiString Address, const AnsiString Service, Word Port, int QueueSize, Boolean Block = True);

Server socket components call Listen to open a listening connection. 

Listen creates the Windows socket that will make the listening connection, and binds the Windows Internet socket address derived from the parameters to the socket. Listen then generates an OnSocketEvent of type seListen. Finally, Listen opens the socket as a listening connection with a queue that can hold QueueSize client requests, setting the Connected property to true. 

The Name, Address, Service, and Port parameters are taken from the Host, Address, Service and Port properties of the server socket component.  

QueueSize indicates how many client requests the listening connection can hold. TServerSocket sets the QueueSize to 5.  

Block indicates whether the socket can look up the information it needs to establish a connection asynchronously. When Block is true, the socket blocks execution for each lookup instead of retrieving information about the connection using asynchronous notifications. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!