3 ms·
If you can build a database, great, but you can probably get by with a device based adaptive ping frequency, reset when connectivity changes. Start at a 1 seco
by toast0 7y ago
If you can build a database, great, but you can probably get by with a device based adaptive ping frequency, reset when connectivity changes.
Start at a 1 second ping, and after each successful ping, double the interval until you get to over a minute. Then add a minute between each ping until you get to 10 minutes, then add ten seconds between each ping. If a connection drops, use the last successful interval for tenish pings, then probe with an additional one second. If the connection drops again while probing, reconnect and wait longer to reprobe. If the first ping failed, then assume the network changed and reprobe from the top.
And yes, you do need to start at one second; I've seen networks with a ten second NAT timeout, which was amazingly disruptive, and thankfully temporary.