Internet Direct (Indy)
Home
PreviousUpNext
TIdSimpleServer.Listen Method

Allows a server to listen for a client connection.

Pascal
function Listen: Boolean; virtual;

Boolean - True on success, False on error.

Listen is a virtual Boolean function that allows TIdSimpleServer to listen for serial connection requests. 

Listen returns True when a the server is able to listen for connection requests on the socket handle for the listener. Listen returns False if Abort has been called, or when an error occurs while accepting new connections on the listener socket handle. 

Listen call BeginListen to initialize the listener socket handle and state prior to allowing the listener to acept new connections. 

Listen contains a control loop that executes while AbortRequested is False and the listener socket handle is not Readable (or still allocated to a previous connection). When the connection is Readable, Listen will wait briefly for a connection request and accept the connection using the AcceptWait timeout value. When a connection request is detected, Listen calls Accept for the Binding using the handle for the listener. 

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

Implementation modified.

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.