From: Ibrahim T. <it...@ar...> - 2012-01-28 20:19:58
|
Hello Everybody, According to Microsoft's documentation: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365141%28v=vs.85%29.aspx > Asynchronous (overlapped) read and write operations are not supported by anonymous pipes. This means that you cannot use the ReadFileEx and WriteFileEx functions with anonymous pipes. In addition, the lpOverlapped parameter of ReadFile and WriteFile is ignored when these functions are used with anonymous pipes. That's why Zoran and I ruled out using unnamed pipes. Named pipes don't seem a good alternative either for several reasons, the least of them being the need to create a name on the fly. However, the entire asynchronous IO in Windows is really messy business, since the entire mechanism of processing IO notifications is tied to a window. -- Ibrahim On 28-Jan-12 19:03, Stephen Deasey wrote: > On Sat, Jan 28, 2012 at 1:26 PM, Zoran Vasiljevic<zv...@ar...> wrote: >> >> On Windows there are some limitations as how you can >> do non-blocking operations... In particular, there >> seems to be a problem with non-blocking reads/writes >> on unnamed pipes... They simply do not work on windows, >> at least as to our knowledge. > > I don't know anything about Windows, but i t looks like PIPE_NOWAIT > switches to non-blocking mode but is a legacy of ye olde lan manager, > and instead you should use overlapped IO with the FILE_FLAG_OVERLAPPED > flag: > > http://msdn.microsoft.com/en-us/library/windows/desktop/aa365788%28v=vs.85%29.aspx > > This is all with named pipes. But it says the followinf about anon pipes: > > Anonymous pipes are implemented using a named pipe with > a unique name. Therefore, you can often pass a handle to an > anonymous pipe to a function that requires a handle to a named pipe. > > So maybe you can substitute a named pipe with the appropriate flags > for the anon pipe? |