summaryrefslogtreecommitdiffstats
path: root/remote-processor/Socket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'remote-processor/Socket.cpp')
-rw-r--r--remote-processor/Socket.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/remote-processor/Socket.cpp b/remote-processor/Socket.cpp
index 2ae8870..77582e2 100644
--- a/remote-processor/Socket.cpp
+++ b/remote-processor/Socket.cpp
@@ -31,11 +31,19 @@
#include <strings.h>
#include <fcntl.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <sys/time.h>
CSocket::CSocket() : _iSockFd(socket(AF_INET, SOCK_STREAM, 0))
{
assert(_iSockFd != -1);
+
+ int iNoDelay = 1;
+ // (see man 7 tcp)
+ // Setting TCP_NODELAY allows us sending commands and responses as soon as
+ // they are ready to be sent, instead of waiting for more data on the
+ // socket.
+ setsockopt(_iSockFd, IPPROTO_TCP, TCP_NODELAY, (char *)&iNoDelay, sizeof(iNoDelay));
}
CSocket::CSocket(int iSockId) : _iSockFd(iSockId)