Friday, January 21, 2011

Overlapped I/O on anonymous pipe

Is it possible to use overlapped I/O with an anonymous pipe? CreatePipe() does not have any way of specifying FILE_FLAG_OVERLAPPED, so I assume ReadFile() will block, even if I supply an OVERLAPPED-structure.

  • No. As explained here, anonymous pipes do not support asynchronous I/O. You need to use a named pipe. There's example code to do this on MSDN here and here.

    From ChrisN
  • Here is an implementation for an anonymous pipe function with the possibility to specify FILE_FLAG_OVERLAPPED. If the link should die in the future search the net for MyCreatePipeEx.

    Steve Hanov : Thanks! That's just what I needed.

0 comments:

Post a Comment