delphi - recovering from "Connection Reset By Peer" Indy TCP Client -
how should recovering in situation?
the server crashes, connection has been abnormally closed. calls result in "connection reset peer" exceptions. seem have fixed calling disconnect on tidtcpclient object inside except block, results in 1 final exception same message (which have caught in second try-except block).
this indy10 , delphi xe2.
try if not ecomsocket.connected ecomsocket.connect(); except on e: exception begin try ecomsocket.disconnect(); except messagedlg('connectivity server has been lost.', mterror, [mbok], 0); end; end; end;
try this:
try if not ecomsocket.connected ecomsocket.connect(); except try ecomsocket.disconnect(false); except end; if ecomsocket.iohandler <> nil ecomsocket.iohandler.inputbuffer.clear; messagedlg('connectivity server has been lost.', mterror, [mbok], 0); end;
Comments
Post a Comment