I'm trying to use NamedPipeServerStream
to create a named pipe server in .Net 4. I'm using BeginWaitForConnection
to wait for the connection, so that I can abort the wait if the server is to be shut down.
Everything works well for the first client --- the connection is acknowledged, the data received, and the response sent OK. However, after the client disconnects everything breaks. I'm calling BeginWaitForConnection
again to wait for a new connection, but this is throwing an IOException
saying that the "pipe is broken".
How can I wait for a second client on the same pipe?