Internet Direct (Indy) Version 9.0.1 Beta
|
procedure CheckForDisconnect(const ARaiseExceptionIfDisconnected: boolean; const AIgnoreBuffer: boolean); virtual;
When the connection has been ClosedGracefully, and the IOHandlerSocket.Binding has an allocated socket handle, then DisconnectSocket is called to force the socket handle to be deallocated.
Under some conditions, CheckForDisconnect can raise an EIdConnClosedGracefully exception. The exception can occur when the Indy Read buffer is empty or should be ignored (as indicated in AIgnoreBuffer), and ARaiseExceptionIfDisconnected indicates that the exception is desired.
For a Server connection, this indicates that the client has disconnected the socket connection normally. The Exception is used to notify Server handling code. The exception is normal and will only happen from within the IDE, not while your program is running as an EXE. If you do not want to see this, add the EIdConnClosedGracefully exception or EIdSilentException to the IDE options as exceptions not to break on. From the IDE, press F9 and Indy will catch and handle the exception.
For a Client connection, this indicates that the server has disconnected the socket connection normally, but the client has attempted to read or write using the closed connection. You should trap this error using a try..except block.
Please see the FAQ at http://www.nevrona.com/Indy/FAQ.html for additional information.