ZeroMQ PUB/SUB with epgm not able to receive messages sent by process on the same host

我怕爱的太早我们不能终老 提交于 2019-12-13 14:52:04

问题


All my processes have two sockets, one PUB and one SUB, and they all use the same multicast address and port.

For example, PUB will do this:

bind("epgm://239.192.1.1:5555")

SUB will do this:

connect("epgm://239.192.1.1:5555")
setsockopt(ZMQ_SUBSCRIBE, "", 0); //subscribe everything

PUB will then send message by calling zmq_send, and SUB will receive by calling zmq_poll and do Nonblocking zmq_recv.

It works perfectly fine when I run two processes on two different hosts. But if I run them on the same host, the send works but recv never receives anything.

I know the send works because if I have the third process run on a different host I'll receive message from both of the first two processes, while the first two processes only receive message sent by the third process.

So I wonder is this because zeromq (or openpgm) does some kind of filtering so messages sent from the socket with same host:port as receiving socket will not be passed to receiving socket?


回答1:


I suspect ZeroMQ is not enabling multicast loopback, or maybe you are supposed to do it yourself somehow via the ZeroMQ API and you aren't.




回答2:


use NORM instead of PGM -> http://zeromq.org/topics:norm-protocol-transport - works well with loopback



来源:https://stackoverflow.com/questions/19141866/zeromq-pub-sub-with-epgm-not-able-to-receive-messages-sent-by-process-on-the-sam

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!