Reputation: 477
I'm using .net 3.5 named pipes and my server side is :
serverPipeStream = new NamedPipeServerStream("myPipe", PipeDirection.InOut, 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous);
When I write some data with, say, BinaryWriter, the write() call itself doesn't return until the client side has called a read() on its NamedPipeClientStream.
The BinaryWriter is :
writer = new BinaryWriter(serverPipeStream);
I'm aware that NamedPipeServerStream offers a BeginRead/BeginWrite but from what I gather, named pipes are supposed to allow streamwriters to perform on top of them (as seen in many Microsoft-given examples).
So how can I make my write() to the named pipe non-waiting ?
Thanks in advance for any help.
Upvotes: 0
Views: 2307
Reputation: 2613
The problem is BinaryWriter doesn't have a BeginWrite
function so, as suggested here, you could write to a MemoryStream and then use the its buffer to pass to the BeginWrite
function of the pipe.
Hope that helps.
Upvotes: 2