Internet Direct (Indy) Version 9.0.2 Beta
TIdSocketHandle.Readable
Determines the read status of a socket.

function Readable(AMSec: Integer): boolean;
Parameters
AMSec: Integer = IdTimeoutDefault
Time-out value in milliseconds. Default is IdTimeoutDefault.

Returns
Boolean - True when the socket can be read.

Description
Readable is a Boolean function that is used to determine the status of the socket connection for read operations. Readable provides access to the Select API of the protocol stack.

Readable returns True when the socket descriptor is ready for read operations using Recv, RecvFrom, or Accept.

Readable will raise an EIdConnClosedGraceful exception if HandleAllocated contains False.

Readable detects the use of a TIdAntifreeze instance in an application. When present, Readable yields processing cycles during the lifetime of the method call to the TIdAntifreeze.DoProcess method.

When AMSec is IdTimeoutInfinite, Readable uses the IdleTimeout value in TIdAntifreeze as its time-out value. Readable will continue executing until the socket is ready to read.

When AMsec is larger than the IdleTimeout value in TIdAntifreeze, Readable is called using the difference between the two time-out values. If the socket is ready to read, no further processing is performed. If the socket is not ready to read, the time-out value is set to the IdleTimeout value in TIdAntifreeze and Readable is called again to determine the socket status. Readable yields processing cycles to the TIdAntifreeze.DoProcess method if the socket is still not ready to read.

Readable does not yield processing cycles when an instance of TIdAntifreeze has not been used in the application.