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

后端 未结 3 627
温柔的废话
温柔的废话 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:38

    The Windows API function CreateNamedPipe has an option to make the handle non-blocking. (See MSDN). Also see the MSDN article on Synchronous and Overlapped I/O. BTW, you can directly compile POSIX compliant code on Windows using MinGW or Cygwin and thus avoid the headache of porting.

提交回复
热议问题