Android Question [Solved]DEcrease timeout (httputils2) job.download2

KMatle

Expert
Licensed User
Longtime User
I'm trying to decrease the timeout of a httpjob to check if the server is working (a "ping" is not enough). I send a simple job calling a php. I wish to decrease the timeout to 2-3 secs (30 is to long to check if the server is working).

For some reasons I can't use Job.GetRequest.Timeout (method "Timeout" is not known) with Job.Download2 (I'm on b4a 4.0 and httputils2 2.01).

Any ideas?
 

Peter Simpson

Expert
Licensed User
Longtime User
Here you go:
B4X:
Dim GetWhatever As HttpJob
    GetWhatever.Initialize("GetWhatever", Me)
    GetWhatever.Download... 'or whatever
    GetWhatever.GetRequest.Timeout = DateTime.TicksPerSecond * 10 '10 = 10 seconds etc...

Enjoy...
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
Pffffff.... No one told me to inlude the http lib!

With httputils2 only there is

GetWhatever.GetRequest but no GetWhatever.GetRequest.Timeout

So the same methods (but different) are in TWO different libs and then merged to one (class)? @Peter Simpson ? Even if httputil2 uses http this confuses as you see.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
So the same methods (but different) are in TWO different libs and then merged to one (class)?
No.

HttpJob is declared in HttpUtils2 library.
HttpRequest is declared in Http library.

HttpJob.GetRequest returns HttpRequest object. The IDE will not recognize this object unless you add a reference to Http library.
 
Upvote 0
Top