net/SocketDescriptor: implement SetNonBlocking() on Windows
This commit is contained in:
parent
fab12ef241
commit
b180604422
@ -181,6 +181,17 @@ SocketDescriptor::GetError()
|
||||
: errno;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
bool
|
||||
SocketDescriptor::SetNonBlocking() noexcept
|
||||
{
|
||||
u_long val = 1;
|
||||
return ioctlsocket(fd, FIONBIO, &val) == 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool
|
||||
SocketDescriptor::SetOption(int level, int name,
|
||||
const void *value, size_t size)
|
||||
|
@ -98,6 +98,8 @@ public:
|
||||
using FileDescriptor::Duplicate;
|
||||
using FileDescriptor::Close;
|
||||
#else
|
||||
bool SetNonBlocking() noexcept;
|
||||
|
||||
/**
|
||||
* This method replaces FileDescriptor::Close(), using closesocket()
|
||||
* on Windows. FileDescriptor::Close() is not virtual, so be
|
||||
|
Loading…
Reference in New Issue
Block a user