So I'm working with a connection to a host where I don't control the code. On my side - I send data and get a response - currently I start the connection at the start of the program and leave it open, as when users are really "going" they can transmit things at roughly 1 per second back to the server. For this reason I don't connect, send data, get response and disconnect (but maybe I should? but seems like a lot of overhead?!?!)
Currently the program works very well, except a few small cases. One specifically is some end users corporate firewalls have inactive TCP timeouts set low, so the user sits the device down while connected, it transmits no data for say 5 minutes, and the firewall ends the connection. In this case, both the server side and the android side think the socket is still connected, thus when I go to send the next packet - it transmits, but I never get any kind of reply, the 10 second timeout does not fire either. No AST errors or anything. There are also other cases, but I don't have the specifics yet, I believe that sometimes when AP hopping takes too long the same thing happens, but hard to be sure.
My biggest issue, is that the server side is hitting a database, during very busy times when say 100+ users are hitting the app/db at the same time, it may be common to not get a response for 5 seconds, so I can't add any kind of "if no response in 5 seconds, drop connection and reconnect" logic without possibly adding additional load to the server at that time.
Is there any other way I can deal with this that I'm not thinking of?
Thanks,
ChrisinKY