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错误。并且该函数无法继续执行,导致线程中断。但重新启动一下线程又恢复正常。请问各位高手有什么办法能够屏蔽该错误,能让该函数能够稳定的执行。即使出错也能够跳出去。
不胜感谢