Is there way to make file descriptor non blocking in windows?

后端 未结 3 595
温柔的废话
温柔的废话 2021-01-14 01:05

I want to port my code from linux to windows. It is something like this:

void SetNonBlocking( int filehandle )
{
    int fhFlags;

    fhFlags = fcntl(fileha         


        
3条回答
  •  粉色の甜心
    2021-01-14 01:21

    Like this:

    ulong arg = 1;
    ioctlsocket(sock, FIONBIO, &arg);
    

    FIONBIO sets the socket in non-blocking mode. Though you should also use OVERLAPPED io as Will suggests. But overlapping and non-blocking is not the same thing.

提交回复
热议问题