HttpClient Timeout

iCAB

Well-Known Member
Licensed User
Longtime User
Hi There

I am using httputil2 and httpclient.
if I leave the program idling for couple of minutes, then I issue an http request.
JobDone returns failure and I get java.net.SocketTimeoutException. Immediately after that if I retry, everything works properly.

Any ideas?

Thank you in advance
 

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Erel
Sorry for the delay in replying, however I didn't want to waste your time. So I did as much testing as possible
The problem doesn't seem to be related to the WiFi connection at all, and here is why:
1. The problem happens within 3-4 minutes of inactivity at the latest
2. The tablet is set to go to sleep mode after 30 minutes
3. Keep Wifi-on during sleep mode ( set to always)
4. I tried online navigation while tablet is timing out , it worked.
5. same http string from my PC browser works ok.

Any ideas?

Thank you
 
Upvote 0

melamoud

Active Member
Licensed User
Longtime User
this might help

hi,
I need that as well, so I added it, see attachement

here are the features I added
'HttpUtils2 version 2.1
' added by nir (after 2.0)
' retries , you can set how many retries until success
' timestamp, timestamp = DateTime.Now when starting to download (+callsubdelay overhead) -so user can calculate how much time it took to bring the data
' add tag and requestType as another strings you can add to keep state of the job (user can do what ever he wants with it)
' add ability to set/get http header fields, so you can change header fields like user-agent for example
' add ability to set wait time in seconds between retries, deafult is 3 sec


let me know if this is what you were looking for.
 

Attachments

  • httpJob.zip
    3.1 KB · Views: 291
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
Hi All
Thanks for all the feedback and for the sample code provided in the attachment ( greatly appreciated )


Implementing a retry mechanism should not be a problem, whoever the behavior is weird and I was looking for some logical explanation on why it happens in the first place.

Well here is the logical explanation.

Luckily the application has a GCM component. During testing I encountered some weird issues with the desktop application trying to send messages to the tablet. I was getting back a response in this format (id=0:1355132381549743%77148e76f9fd7; Not the exact same one in here but similar )

While searching the internet for answers, someone mentioned that the type of response that I was getting back from the GCM server is related to an error in one of the network layers.

By changing my router all the problems are gone.

If I put the old router back, I am able to regenerate the issues.
Now I can use the old router(D-LINK DIR-615) as a priceless test environment to simulate failure situation, so I do recommend it for testing :)
 
Last edited:
Upvote 0
Top