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

@@ -25,6 +25,13 @@
#ifdef __linux__
#include <unistd.h>
#include <sys/select.h>
#include <netinet/tcp.h>
#endif
#ifdef __linux__
const int yes = 1;
#else
const char yes = 1;
#endif
using namespace std::chrono_literals;
@@ -438,6 +445,13 @@ int NetworkClient::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));
}