El 24/02/18 a les 13:00, Luca Olivetti ha escrit:
Sure, with some combination of kernel/winsock version it could possibly
work (with mine it doesn't), but then it would be just enough to set the
IoTimeout in the TFpHttpClient (which I'm already doing), no need to
modify ssockets.pp.
Correction: it works in linux (IIRC it didn't some years ago, now it's a
documented feature, see https://linux.die.net/man/7/socket) but it
doesn't in windows (where the only option is to use a non-blocking socket).
Unluckily enough, my current target is windows :-(
Test procedure:
procedure TForm1.Button1Click(Sender: TObject);
var c:TFPHTTPClient;
inicio: QWord;
begin
c:=TFPHTTPClient.Create(nil);
c.IOTimeout:=500;
inicio:=GetTickCount64;
try
memo1.lines.add(c.Get('http://192.168.10.221/'));
except
on e:exception do
memo1.lines.add(e.Message);
end;
caption:=IntToStr(GetTickCount64-inicio);
c.free;
end;
The timeout is roughly 500 ms under linux, 18-20 seconds under windows
(xp/7, didn't test 10).
Bye
--
Luca
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal