[fpc-pascal] fphttclient, no way to specify a connect timeout

Luca Olivetti luca at ventoso.org
Sat Feb 24 13:00:35 CET 2018


El 24/02/18 a les 10:19, Dimitrios Chr. Ioannidis via fpc-pascal ha escrit:
> Hi,
> 
> On 2018-02-24 03:42, Luca Olivetti wrote:
>> El 23/02/18 a les 22:57, Dimitrios Chr. Ioannidis via fpc-pascal ha 
>> escrit:
>>> Hi
>>>
>>> Στις 23/2/2018 11:14 μμ, ο Luca Olivetti έγραψε:
> <snip>
>>> The TFPCustomHTTPClient calls TInetSocket.Create constructor which it 
>>> calls the inherited constructor from TSocketStream.
>>
>> Which, since TFPHttpClient assigns a socket handler in G, it won't 
>> call connect.
>> So the timeout set above is really done before the connect call.
> 
> OK. I got it. Point taken.

I don't think you did: what you are proposing is what TFpHttpClient 
already does, I traced it, it really does the call to SetIoTimeout 
before the connect call, and it doesn't work.
The only reliable way to enforce a connect timeout is to try to connect 
in non-blocking mode.
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.

Bye
-- 
Luca



More information about the fpc-pascal mailing list