Topic Path: Symbol Reference > Classes > TIdIOHandlerStack Class > TIdIOHandlerStack Methods > CheckForDisconnect Method
ContentsIndexHome
PreviousUpNext
TIdIOHandlerStack.CheckForDisconnect Method

Checks state and status information on the transport for the IO handler.

procedure CheckForDisconnect(
    ARaiseExceptionIfDisconnected: Boolean = True; 
    AIgnoreBuffer: Boolean = False
); override;
Parameters 
Description 
ARaiseExceptionIfDisconnected 
Indicates if exceptions are raised when the connection has closed prematurely.
 
AIgnoreBuffer 
Indicates if data in the internal buffer is ignored when the connection has closed prematurely. 

CheckForDisconnect is an overridden procedure that implements the method used to inspect the status of the connection prior to or following a method call that performs an IO operation. 

CheckForDisconnect is used primarily to ensure that state and status properties for the IOHandler are synchronized with the underlying transport mechanism. 

ClosedGracefully indicates the the server has closed the connection for the IOHandler. If the socket handle is still allocated and bound, CheckForDisconnect will call Close and trigger the OnStatus event handler for the connection. 

If the connection for the IOHandler has been closed and InputBuffer does not contains unread data in the internal buffering mechanism, the IOHandler can raise an EIdConnClosedGracefully exception. 

Use AIgnoreBuffer to indicate that unread data in InputBuffer should be ignored. 

Set ARaiseExceptionIfDisconnected to False to prevent the exception from being raised.

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