Update README.md, add heartbeat packets to detect dead or hanging connections.

This commit is contained in:
2025-11-10 15:19:54 +01:00
parent 2cbcf70c56
commit b3d9ae8909
5 changed files with 164 additions and 8 deletions

View File

@@ -74,10 +74,10 @@ int main(int argc, char** argv) {
log("Client connected to " + host + ":" + port);
// Client is running
while (!done) {
while ((!done && client->isConnected()) || !client->isHandshakeComplete()) {
std::this_thread::sleep_for(std::chrono::milliseconds(100)); // Temp wait
if (client->isHandshakeComplete() && client->isConnected()) {
if (client->isHandshakeComplete()) {
// Send a test UDP message every 5 seconds after handshake is complete
static auto lastSendTime = std::chrono::steady_clock::now();
auto now = std::chrono::steady_clock::now();