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

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

    The term for non-blocking / asynchronous I/O in Windows is 'overlapped' - that's what you should be looking at.

    Basically, you identify a file handle as using overlapped i/o when you open it, and then pass an OVERLAPPED structure into all the read and write calls. The OVERLAPPED structure contains an event handle which can be signalled when the I/O completes.

提交回复
热议问题