How detect and resume wireless socket connection falldown?
#1 Members - Reputation: 105
Posted 02 February 2013 - 01:03 AM
#2 GDNet+ - Reputation: 516
Posted 02 February 2013 - 05:37 AM
This is just an idea, so please inform me if it is totally misplaced
Even though the speed is slowed, time is not, so the client should be able to detect that time gap/leap and drop the connection itself after a fixed time interval without signal. The key is that the server's time interval must be a little larger to accommodate clients clients wanting to resuming (without luck) after an interval close to their time limit.
For instance, where X is some time interval (the 1.5 is probably way too much, depending on X itself it may be smaller, but you get the idea):
ClientDropTime = X
ServerDropTime = X * 1.5
#3 Moderators - Reputation: 3282
Posted 03 February 2013 - 04:56 PM
Similarly, some routers will "forget" about TCP connections if too much is going on, or it's idle for too long.
You could set up a system of keepalives/heartbeats. Send a heartbeat in each direction every 1 seconds. If one of the sides hasn't seen a heartbeat for 5 seconds, assume the other end is gone, close the socket, and try to re-open a new connection (if on the client) or just close the socket on the server.
Another option is to use UDP, although you'll need the heartbeat anyway.
#4 Members - Reputation: 105
Posted 05 February 2013 - 03:00 AM






