non blocking

This commit is contained in:
Benjamin Sergeant 2018-10-08 20:20:09 -07:00
parent 280d1d7366
commit 44e5ab7f7d

View File

@ -152,7 +152,13 @@ namespace ix
{ {
int flag = 1; int flag = 1;
setsockopt(_sockfd, IPPROTO_TCP, TCP_NODELAY, (char*) &flag, sizeof(flag)); // Disable Nagle's algorithm setsockopt(_sockfd, IPPROTO_TCP, TCP_NODELAY, (char*) &flag, sizeof(flag)); // Disable Nagle's algorithm
#ifdef _WIN32
unsigned long nonblocking = 1;
ioctlsocket(fd, FIONBIO, &nonblocking);
#else
fcntl(_sockfd, F_SETFL, O_NONBLOCK); // make socket non blocking fcntl(_sockfd, F_SETFL, O_NONBLOCK); // make socket non blocking
#endif
#ifdef SO_NOSIGPIPE #ifdef SO_NOSIGPIPE
int value = 1; int value = 1;