Use abstraction because Windows is not POSIX
Fixes #138 Change-Id: I4d9b49762e318fe91f1561ed315829b43daefef4
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user