|
From: Jimmie on 12 May 2008 09:45 Is there any way to wait on data from a pipe? I see WaitNamedPipe waits for a pipe's availability - that's not what I want. I'd like to wait until data is available in a named pipe. Then, if data does not arrive within a given timeout (say 5 seconds), return a flag saying it timed out, and continue. I can think of a few ways to accomplish this, but none are very efficient. Anyone have any suggestions?
From: Doug Harrison [MVP] on 12 May 2008 12:26 On Mon, 12 May 2008 06:45:46 -0700 (PDT), Jimmie <oskard(a)gmail.com> wrote: >Is there any way to wait on data from a pipe? I see WaitNamedPipe >waits for a pipe's availability - that's not what I want. > >I'd like to wait until data is available in a named pipe. Then, if >data does not arrive within a given timeout (say 5 seconds), return a >flag saying it timed out, and continue. > >I can think of a few ways to accomplish this, but none are very >efficient. Anyone have any suggestions? Pass FILE_FLAG_OVERLAPPED to CreateNamedPipe and use asynchronous I/O. -- Doug Harrison Visual C++ MVP
From: Jimmie Tyrrell on 12 May 2008 15:54 On May 12, 12:26 pm, "Doug Harrison [MVP]" <d...(a)mvps.org> wrote: > On Mon, 12 May 2008 06:45:46 -0700 (PDT), Jimmie <osk...(a)gmail.com> wrote: > >Is there any way to wait on data from a pipe? I see WaitNamedPipe > >waits for a pipe's availability - that's not what I want. > > >I'd like to wait until data is available in a named pipe. Then, if > >data does not arrive within a given timeout (say 5 seconds), return a > >flag saying it timed out, and continue. > > >I can think of a few ways to accomplish this, but none are very > >efficient. Anyone have any suggestions? > > Pass FILE_FLAG_OVERLAPPED to CreateNamedPipe and use asynchronous I/O. > > -- > Doug Harrison > Visual C++ MVP Very helpful as usual Doug. FILE_FLAG_OVERLAPPED and and OVERLAPPED data structure did the trick. Thank you.
|
Pages: 1 Prev: new WCHAR(LPDWORD) gives warning for 64-bit Next: istringstream and setw |