可以连接到命名管道的客户端数量
假设服务器创建了一个命名管道“myTestPipe”。 有多少客户端可以连接到“myTestPipe”? 从我在网上读到的信息来看,似乎只有一个客户可以,但想确定一下。
如果只有一个,那么最好使用阻塞的 WaitForConnection() 而不是 Asunchronous 方法 BeginWaitForConnection(),因为服务器将等待客户端进程连接,然后进行通信?! (无需担心其他客户端连接)
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.
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以让多个客户端连接到同一命名管道。 在 Windows 上,我认为当前的限制是到单个命名管道的 256 个同时连接,包括服务器的连接。
(不幸的是,我无法找到适当的 MSDN 页面以供参考,但是这个 CPAN 管道参考提到了此限制。)
You can have more than one client connect to the same named pipe. On Windows, I believe the current limitation is 256 simultaneous connections to a single named pipe, including the server's connection.
(Unfortunately, I can't track down the appropriate MSDN page for reference, but this CPAN pipes reference mentions this limitation.)
实际上,您创建一个管道并等待连接,当它连接时,创建第二个管道并等待它。
对于您创建并等待连接的每个管道,您最多获得一个连接(一次 - 如果它们是请求/响应/关闭样式,您可以回收它们)。
因此,每个连接都是一对一的,就像套接字或其他流一样。
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).
Thus, each connection is 1-to-1, like a socket or other stream.