Set TCP_QUICKACK on Linux to improve responsiveness when using client/service configuration

This commit is contained in:
Adam Honse
2026-01-06 00:00:10 -06:00
parent 2a1b7a9e2e
commit d09c66900d
3 changed files with 38 additions and 2 deletions

View File

@@ -26,14 +26,18 @@
#include <stdlib.h>
#include <iostream>
const char yes = 1;
#ifdef WIN32
#include <Windows.h>
#else
#include <unistd.h>
#endif
#ifdef __linux__
const int yes = 1;
#else
const char yes = 1;
#endif
using namespace std::chrono_literals;
NetworkClientInfo::NetworkClientInfo()
@@ -548,6 +552,13 @@ int NetworkServer::recv_select(SOCKET s, char *buf, int len, int flags)
}
else
{
/*-------------------------------------------------*\
| Set QUICKACK socket option on Linux to improve |
| performance |
\*-------------------------------------------------*/
#ifdef __linux__
setsockopt(s, IPPROTO_TCP, TCP_QUICKACK, &yes, sizeof(yes));
#endif
return(recv(s, buf, len, flags));
}
}