How should I recover in this situation?
The server crashes, so the connection was abnormally closed. Calls to almost everything lead to Connection Reset By Peer exceptions. I seem to have fixed this by calling Disconnect on the TIdTCPClient object inside the except block, but this leads to one final exception with the same message (which I found in the second try-except block).
This is with Indy10 and Delphi XE2.
try if not EcomSocket.Connected then EcomSocket.Connect(); except on e: Exception do begin try EcomSocket.Disconnect(); except MessageDlg('Connectivity to the server has been lost.', mtError, [mbOK], 0); end; end; end;
Andy clark
source share