Topic Path: Symbol Reference > Classes > TIdSocketHandle Class > TIdSocketHandle Methods > Readable Method
TIdSocketHandle.Readable Method

Determines if the socket handle is available for reading.

function Readable(
    AMSec: Integer = IdTimeoutDefault
): boolean;
Numberof milliseconds to wait for the socket handle to become ready. The default value is IdTimeoutDefault

boolean - True when the socket handle is ready.

Readable is a boolean function used to determine when the socket handle for the connection is available. Readable returns True when the socket descriptor is ready for read operations using Receive, RecvFrom, or Accept

Readable uses HandleAllocated to determine if the socket handle for the connection is still valid. An EIdConnClosedGracefully exception is raised if the handle is no longer connected or assigned. 

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 to execute 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 calls Select to add the socket handle to read list for the protocol stack.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.