[fpc-pascal] fphttpclient and timeout

silvioprog silvioprog at gmail.com
Fri Oct 24 13:54:38 CEST 2014


On Fri, Oct 24, 2014 at 8:41 AM, Michael Van Canneyt <michael at freepascal.org
> wrote:
>
> On Fri, 24 Oct 2014, Philippe wrote:
>>
>> Using basically HTTPClient.Get, I did not find time out configuration
>> with fphttpclient. Did I missed it?
>>
>
> it does not exist yet.
>
>
>> If not, is there a way to implement it ? Using thread?
>>
>
> that would be one way.
>
>
>> If not, is there a similar library/unit with configurable timeout?
>>
>
> synapse probably has it.
>
> Michael.



You could implement the timeout directly in the internal FSocket in
TFPHttpClient(*). I implemented that using "GetTick"[1] and "TTimeVal"[2]:

Just suggestions! =)

(*) E.g:

TFPCustomHTTPSocket = class(TInetSocket) // implementing the timout
..
  TFPCustomHTTPClient = Class(TComponent)
  private
...
    FSocket : TFPCustomHTTPSocket; // using TFPCustomHTTPSocket instead of
TInetSocket directly because TFPCustomHTTPSocket implements the timeout

[1] -
https://github.com/silvioprog/tcpipcomp/blob/master/src/tcpipbase.pas#L105

[2] -
https://github.com/silvioprog/tcpipcomp/blob/master/src/tcpipclient.pas#L130

--
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20141024/22d367c2/attachment.html>


More information about the fpc-pascal mailing list