Merge "emulator opengles: improve TcpStream throughput"
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/TcpStream.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/TcpStream.cpp
index 4e947da..c057ff9 100644
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/TcpStream.cpp
+++ b/tools/emulator/opengl/shared/OpenglCodecCommon/TcpStream.cpp
@@ -23,6 +23,9 @@
 
 #ifndef _WIN32
 #include <netinet/in.h>
+#include <netinet/tcp.h>
+#else
+#include <ws2tcpip.h>
 #endif
 
 TcpStream::TcpStream(size_t bufSize) :
@@ -39,6 +42,15 @@
     m_bufsize(bufSize),
     m_buf(NULL)
 {
+    // disable Nagle algorithm to improve bandwidth of small
+    // packets which are quite common in our implementation.
+#ifdef _WIN32
+    DWORD  flag;
+#else
+    int    flag;
+#endif
+    flag = 1;
+    setsockopt( sock, IPPROTO_TCP, TCP_NODELAY, (const char*)&flag, sizeof(flag) );
 }
 
 TcpStream::~TcpStream()