-1

Is there a way to write multiple buffers into NamedPipe using a single OVERLAPPED operation?

Martin Sustrik
  • 783
  • 10
  • 22

1 Answers1

2

Not directly, no. You would have to copy the buffers into a single contiguous memory block and then write that instead.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • On second thoughts, what's wrong with [`WriteFileGather`](http://msdn.microsoft.com/en-us/library/windows/desktop/aa365749(v=vs.85).aspx) ? – Harry Johnston Jun 08 '14 at 02:45
  • D'oh! I see the problem; presumably, FILE_FLAG_NO_BUFFERING isn't valid for pipes. @Martin: note that unless the buffers are quite small, it's probably going to be more efficient to just do multiple operations. This isn't usually as inconvenient as it sounds, because you'd have had to track the buffers anyway in order to free them once the operation is complete. – Harry Johnston Jun 08 '14 at 02:49
  • Multiple operations are OK in fact. What's annoying is having multiple completion events. Is it possible to do multiple writes and have only a single completion event? – Martin Sustrik Jun 09 '14 at 05:08
  • @MartinSustrik: in message mode, no. Reads/writes are 1:1. But in stream mode, I would assume so, just provide a bigger buffer to read into. – Remy Lebeau Jun 09 '14 at 18:36