Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-10

fphttpclient and timeout

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Philippe

Using basically HTTPClient.Get, I did not find time out configuration with fphttpclient. Did I missed it?

If not, is there a
way to implement it ? Using thread?

If not, is there a similar
library/unit with configurable timeout?

I appreciate any suggestion!

Philippe

Michael Van Canneyt
to Philippe
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.

silvioprog
to Michael Van Canneyt

On Fri, Oct 24, 2014 at 8:41 AM, Michael Van Canneyt <

Show quoted text 23 lines
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
Philippe
to silvioprog: On Fri, Oct 24, 2014 at 8:41 AM, Michael Van Canneyt < You could implement the timeout…
silvioprog wrote
On Fri, Oct 24, 2014
Michael Van Canneyt wrote
> On
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.

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

Show quoted text 6 lines
Just suggestions! =) (*) E.g:

TFPCustomHTTPSocket = class(TInetSocket) // implementing the timout

..

Show quoted text 5 lines
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 [1]

[2] -

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

-- Silvio Clécio My public projects - github.com/silvioprog

[3]

Thanks ... may be a bit complicated for me now ... I keep it for

later!