Hi,
I need to get the HTML content from a URL list. I don't want to spend more than
10 seconds on each URL either if the remote server is down or a read timeout
occurs. I've tried with:
function GetUrlContentUTF8ICS(const Url: string):UTF8String;
var
lData: TStringStream;
httpcli1 : THTTPCli;
begin
Result:= '';
lData := TStringStream.Create();
httpcli1:= THTTPCli.Create(nil);
httpcli1.Timeout:= 10000;
//
httpcli1.RcvdStream := lData;
httpcli1.URL:= url;
try
httpcli1.get;
Result:= lData.DataString;
except
Exit;
end;
lData.Free;
httpcli1.Free;
end;
But the timeout doesn't occur and it gets hanged in slow or offline websites.
Am I missing something. Is it needed to implement a Timer based solution for
this?
Thanks,
Miguel
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be