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.
No. The Wait For is what is causing the HTTP request to process. Please note: all statements between xxx.Download and the Wait For for that particular job must be blocking calls. Otherwise the event queue is processed and the download event occurs and may finish before you set up your Wait For. If that occurs, your Wait For will seem to hang, since the event that it is waiting for has already happened.
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.
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
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.
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:
This is a follow on thread to: https://www.b4x.com/android/forum/threads/how-do-i-detect-a-http_job-has-timed-out-when-i-use-wait-for.142809/ The problem I have been getting is that very occasionally I get a http job that never seems to complete - I'm guessing it timeouts, but does not give...