B4J Question How do I detect a Http_job has timed out when I use Wait For

JackKirk

Well-Known Member
Licensed User
Longtime User
I have a Http_job, the bare bones of the relevant code to execute it are:

B4X:
    Private XXX_job As Http_Job

    XXX_job.Initialize("List", Me)
    
    wrk_URI stuff here

    XXX_job.Download(wrk_URI)

    XXX_job.GetRequest.Timeout = 30 * DateTime.TicksPerSecond      'I know this is the default
    
    wrk_Authorization stuff here
 
    XXX_job.GetRequest.SetHeader("Authorization", wrk_Authorization)

    Wait For (XXX_job) JobDone (Job As Http_Job)

Occasionally this hangs on the Wait For - I am assuming it is timing out.

How do I detect this?

Thanks...
 
Last edited:

JackKirk

Well-Known Member
Licensed User
Longtime User
OliverA - thanks that is good info - I presume by "blocking call" you mean a call that does not entail a Sleep or Wait For in its execution trail.

If that's the case then there are none between:

XXX_job.Download(wrk_URI)

-and-

Wait For ...

drgottjr - thanks - I will follow your suggestions up and report back in this thread - may take a while because this problem only surfaces every couple of days.

How to set the default HTTP connection timeout

Hi, I can set the HTTP connection timeout for a call with Job1.GetRequest.Timeout But I have to do this on every call. Is there a way to set the timeout globally? Thanks
www.b4x.com
TILogistic - thanks - I will follow your suggestions up and report back in this thread - may take a while because this problem only surfaces every couple of days.
 
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
Apologies for taking some time to tidy up this thread - but the problem only occurs rarely and I wanted to wait for it to happen before offering a work around - which I have placed in a new thread:

 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…