Use abstraction because Windows is not POSIX

Fixes #138

Change-Id: I4d9b49762e318fe91f1561ed315829b43daefef4
This commit is contained in:
Tim Newsome
2017-12-13 14:32:11 -08:00
parent 3624d5e5eb
commit 7eceac758c
2 changed files with 13 additions and 2 deletions
+11
View File
@@ -199,6 +199,17 @@ static inline int close_socket(int sock)
#endif
}
static inline void socket_block(int fd)
{
#ifdef _WIN32
unsigned long nonblock = 0;
ioctlsocket(fd, FIONBIO, &nonblock);
#else
int oldopts = fcntl(fd, F_GETFL, 0);
fcntl(fd, F_SETFL, oldopts & ~O_NONBLOCK);
#endif
}
static inline void socket_nonblock(int fd)
{
#ifdef _WIN32