高手问题——idhttp如果屏蔽#10053错误 ( 积分: 50 )

  • 主题发起人 inseasoft
  • 开始时间
I

inseasoft

Unregistered / Unconfirmed
GUEST, unregistred user!
现有一函数代码
Function Get_For_Host_ByIdHttp(aHost , aUrl: string) : Boolean ;
var
IdHTTP1: TIdHTTP;
begin
try
Result := True;
IdHTTP1 := TIdHTTP.Create(nil);
with IdHTTP1do
begin
try
ReadTimeout := 15000;
Port := 80 ;
Host := aHost;
Connected ;
DataString := Get(aUrl) ;
except
on E: Exceptiondo
begin
Result := False;
end;
end;
end;
finally
IdHTTP1.DisconnectSocket ;
IdHTTP1.Free;
end;
end

有一线程不停调用该函数,时间长后会出现#10053错误。并且该函数无法继续执行,导致线程中断。但重新启动一下线程又恢复正常。请问各位高手有什么办法能够屏蔽该错误,能让该函数能够稳定的执行。即使出错也能够跳出去。
不胜感谢
 
现有一函数代码
Function Get_For_Host_ByIdHttp(aHost , aUrl: string) : Boolean ;
var
IdHTTP1: TIdHTTP;
begin
try
Result := True;
IdHTTP1 := TIdHTTP.Create(nil);
with IdHTTP1do
begin
try
ReadTimeout := 15000;
Port := 80 ;
Host := aHost;
Connected ;
DataString := Get(aUrl) ;
except
on E: Exceptiondo
begin
Result := False;
end;
end;
end;
finally
IdHTTP1.DisconnectSocket ;
IdHTTP1.Free;
end;
end

有一线程不停调用该函数,时间长后会出现#10053错误。并且该函数无法继续执行,导致线程中断。但重新启动一下线程又恢复正常。请问各位高手有什么办法能够屏蔽该错误,能让该函数能够稳定的执行。即使出错也能够跳出去。
不胜感谢
 
具体错误如下
Socket Error # 10053
Software caused connection abort.
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
813
import
I
I
回复
0
查看
913
import
I
顶部