可以连接到命名管道的客户端数量 [英] Number of Clients that can connect to a Named Pipe
问题描述
假设服务器创建了一个命名管道"myTestPipe".多少个客户端可以连接到"myTestPipe"?根据我在网上阅读的内容,似乎只有一个客户端可以,但是想确保.
Say a server created a named pipe "myTestPipe". How many clients can connect to "myTestPipe"? From what I have read on the Web, it seems only one client can, but wanted to make sure.
如果只有一个,那么最好使用阻塞的WaitForConnection()而不是Asunchronous方法BeginWaitForConnection(),因为服务器将等待直到客户端进程连接然后进行通信?! (无需担心其他客户端可以连接)
If only one, then it's best to use the blocking WaitForConnection() instead of the Asunchronous method BeginWaitForConnection() as the server will wait until a client process connects and then do the communication?! (no need to worry about other clients to connect)
推荐答案
您实际上创建了一个管道并等待连接,当连接时,创建了另一个并等待.
You actually create one pipe and wait for a connection, and when it connects, create a second one and wait on it.
对于创建并等待连接的每个管道,最多只能获得一个连接(一次-如果它们是请求/响应/关闭样式,则可以回收它们).
For each pipe you create and wait for connection on, you get at most one connection (at a time - you can recycle them if they are request/response/close style).
因此,每个连接都是1对1的连接,就像套接字或其他流一样.
Thus, each connection is 1-to-1, like a socket or other stream.
这篇关于可以连接到命名管道的客户端数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!