Indy10中的和GetResponse有关的方法如果没有读取到数据不能超时返回吗?
查看了GetResponse的源码,发现使用的读取操作是:
LLine := IOHandler.ReadLnWait;
ReadLnWait的代码如下:
function TIdIOHandler.ReadLnWait(AFailCount: Integer = MaxInt): string;
var
LAttempts: Integer;
begin
// MtW: this is mostly used when empty lines could be send.
Result := '';
LAttempts := 0;
while (Length(Result) = 0) and (LAttempts < AFailCount) do begin
Inc(LAttempts);
Result := Sys.Trim(ReadLn);
end;
end;
//ReadLnWait默认将一直阻塞,知道读取数据
//ReadLn可以通过设置ReadTimeout属性超时返回,但是AFailCount不能设置啊,默认就是MaxInt
//当然,可以修改代码,将ReadLnWait改为ReadLnWait(n)
请问除了修改这里的代码外,还有其他属性值可以使之超时返回吗?
另外,不解决这个问题,那么误连上一个服务器,也会一直阻塞的