The number of clients that can connect to the named pipe

Suppose the server created the named pipe "myTestPipe". How many clients can connect to myTestPipe? From what I read on the Internet, it seems that only one client can, but wanted to make sure.

If there is only one, then it is better to use the WaitForConnection () lock instead of the Asunchronus BeginWaitForConnection () method, since the server will wait for the client process to connect, and then make a message ?! (no need to worry about connecting other clients)

+5
c # named-pipes
source share
2 answers

You can connect more than one client to the same named pipe. On Windows, I believe that the current limitation is 256 concurrent connections to the same channel, including connecting to the server.

(Unfortunately, I cannot track the corresponding MSDN page for reference, but this link

+9
source share

In fact, you create one channel and wait for the connection, and when it connects, create the second and wait for it.

For each channel that you create and wait for a connection, you get no more than one connection (at a time - you can rework them if this is a request / response / close style).

Thus, each connection is 1-to-1, like a socket or other stream.

+9
source share

All Articles