Unix中的多播IPC选项 [英] Multicast IPC options in unix

查看:90
本文介绍了Unix中的多播IPC选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下IPC选项列表中,它们可以执行多播(即1个发送者和多个接收者):

Among the following list of IPC options, which could perform multicast (i.e. 1 sender and multiple receivers):

  • 信号
  • 半双工管
  • 命名管道
  • 系统V消息队列
  • unix域套接字

修改

  • 内存映射文件

据我了解,使用命名管道(不确定)可能是可行的.

From my understanding, it might be possible with named pipe (not sure).

推荐答案

在概念上没有多播具有任何灵活性,但是由于一些限制,某些功能可能会满足您的要求.

There's nothing as conceptually flexible as multicast, but with a few limitations some of the facilities might do what you want.

信号可以传递给流程组.您列出的其他IPC机制具有发送者/接收者模型,不适合多播,除非注释中的@Barmar指出,否则禁止本地扩展(如Linux的多播AF_UNIX套接字).

Signals may be delivered to a process group. The other IPC mechanisms you list have a sender/receiver model and are not suitable for multicast, barring local extensions like Linux's multicast AF_UNIX sockets as @Barmar points out in the comments.

如果您只需要向后代进程发送单个信号",并且仅发送一次,则可以使用继承的fifo.所有接收器都继承fifo的读取端,而不继承写入端.持有写端的进程在某个时候将其关闭,所有接收者都会在其读端副本上检测到EOF.

If you only need to send a single "signal" to descendant processes, and only once, you may use an inherited fifo. All receivers inherit the read end of the fifo but not the write end. The process holding the write end closes it at some point, and all receivers will detect EOF on their read end copies.

这篇关于Unix中的多播IPC选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆