H
Harry_Ben
Unregistered / Unconfirmed
GUEST, unregistred user!
使用TClientSocket,再服务器速度慢时,会弹出10060错误,可是程序中,已经加了错误处理.
1.Open时捕获错误(可以去掉10061,OnError中无法去掉10061,但无法捕获10060)
try
if CS.Active then CS.Close;
CS.Open;
except
end
2.正常处理,(无法捕获10060,10061等)
procedure TfrmWg.CSError(Sender: TObject; Socket: TCustomWinSocket;
ErrorEvent: TErrorEvent; var ErrorCode: Integer);
begin
ErrorCode := 0;
if ErrorEvent = eeConnect then
begin
try
Socket.Free;
except
end;
end;
end;
是不是TClientSocket本身就有呢?
1.Open时捕获错误(可以去掉10061,OnError中无法去掉10061,但无法捕获10060)
try
if CS.Active then CS.Close;
CS.Open;
except
end
2.正常处理,(无法捕获10060,10061等)
procedure TfrmWg.CSError(Sender: TObject; Socket: TCustomWinSocket;
ErrorEvent: TErrorEvent; var ErrorCode: Integer);
begin
ErrorCode := 0;
if ErrorEvent = eeConnect then
begin
try
Socket.Free;
except
end;
end;
end;
是不是TClientSocket本身就有呢?