What you need to do is handle the Error event from TClientSocket, because that is where you can fix socket errors.
ErrorCode - , WinSock
Error, ErrorCode 0, , , , , .
procedure TForm1.ClientSocket1Error(Sender: TObject;
Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
var ErrorCode: Integer);
var error : Integer;
begin
error := ErrorCode; {prevent exception from being thrown}
ErrorCode := 0;
if error = 10049 then
showmessage('asynchronous socket error');
.
.
.
end;
,