2

我正在处理进程间通信。我遇到了命名管道通信。

我已经有了一些基本的想法,但需要确定以下几点?

  1. 名称管道是否可以同时拥有多个客户端?

  2. 它是否支持基于不同语言的不同进程的通信。

请告诉我,进程间通信的命名管道通信和广播有什么区别?

4

1 回答 1

5

No, a single pipe only supports a single client. Much like a web server, it also creates multiple connections to each individual client. A pipe server works the same way.

Yes, bridging the wall between processes is a major use case for named pipes.

Windows supports a different object for broadcasting, a mailslot. It was never ported to .NET, it is pretty useless. Broadcasting is not reliable, it is like yelling in a crowded football stadium without any guarantee that anybody can hear you. If you need broadcasts then you should consider an UDP socket. And of course deal with the consequence of it randomly losing data.

WCF is the usual recommendation if you consider named pipes. It puts a layer on top of them to make them easier to use.

于 2014-02-14T14:48:45.297 回答