HttpUtils2Service/HttpJob timeout


Licensed User
Longtime User
Hello - My name is George, and i'm a recovering Windows Mobile Win32/C code surviver. Android newbie, not so new to Basic. i've chosen Basic4android. Thanks for all the hard work.

I wanted to add/insert a timeout, as needed, when initializing an httpjob. If I correctly read some comments relating to timeouts, my understanding is that they will fire if nothing is being transmitted (presumably the server is not up or answering). This is what i'm looking for.

At this point I'm certainly not interested in modifying the httputils2service or httpjob files. And in looking at those files I don't see where the req as HttpRequest in httpjob is exposed to my main activity in any case for me to set its timeout property. But I do see a GetRequest method which, for the moment at least, seems like it might be a way to access the job.

I refer to a snippet I found elsewhere:
Dim req As HttpRequest
req.InitializePost2(url, PostBytes)
req.Timeout = 10000

The timeout setting could be inserted like this directly into the httpjob.bas, but the hardcoding aspect is kind of desperate, to say the least. I wanted to be able to set the timeout from the main activity.

Could I please have any suggestions or thoughts on this? I was hoping to avoid opening old head banging wounds at this early stage. Thanks in advance.



Licensed User
Longtime User
You can use this code:
Dim Job1 As HttpJob
Job1.Download(...) 'Or PostBytes / PostFile 
Job1.GetRequest.Timeout = 10000 'timeout will be set before the download will start

thank you, sir.
Upvote 0