Internet Direct (Indy) Version 9.0.2 Beta
TIdSimpleServer.Listen
Allows a server to listen for a client connection.

function Listen: Boolean; virtual;
Returns
Boolean - True on success, False on error.

Description
Listen is a Boolean function that allows TIdSimpleServer to listen for serial connection requests. Listen returns True when a connection request is detected, accepted, and is readable. Listen returns False if the AcceptWait timeout period elapses while trying to select the socket handle, or the Abort procedure is called.

Listen call BeginListen to initialize the server socket handle and state prior to entering the listener thread of execution. Listen provides a control loop that uses both AbortRequested and the socket handle Binding to determine when the server should stop listening for a client connection.

While AbortRequested is False, Listen will insure that the Binding is readable using the AcceptWait timeout value. When a connection request is detected, Listen calls Accept using the Handle for Binding.

When AbortRequested is True or a new connection has handled with Accept, Listen will close and invalidate the socket handle in ListenHandle.