Determines if the peer has gracefully disconnected. procedure CheckForGracefulDisconnect(const ARaiseExceptionIfDisconnected: boolean); virtual;Parametersconst ARaiseExceptionIfDisconnected: boolean = trueRaise an exception when the connection is closed. Default value is True.DescriptionCheckForGracefulDisconnect is a procedure used to determine if the connection has closed gracefully. CheckForGracefulDisconnect calls ReadFromStack using the value in ARaiseExceptionIfDisconnected and a 1 millisecond timeout to verify that the socket handle is ready to perform a read operation. ReadFromStack updates the ClosedGracefully property and performs exception handling as specified in ARaiseExceptionIfDisconnected. try IdTCPClient1.CheckForGracefulDisconnect(); except //非正常断开处理 end;
procedure CheckForGracefulDisconnect(const ARaiseExceptionIfDisconnected: boolean); virtual;Parametersconst ARaiseExceptionIfDisconnected: boolean = trueRaise an exception when the connection is closed. Default value is True.DescriptionCheckForGracefulDisconnect is a procedure used to determine if the connection has closed gracefully.
CheckForGracefulDisconnect calls ReadFromStack using the value in ARaiseExceptionIfDisconnected and a 1 millisecond timeout to verify that the socket handle is ready to perform a read operation.
ReadFromStack updates the ClosedGracefully property and performs exception handling as specified in ARaiseExceptionIfDisconnected.
try
IdTCPClient1.CheckForGracefulDisconnect();
except
//非正常断开处理
end;