Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 442
swang Avatar asked Dec 04 '25 05:12

swang


1 Answers

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.

like image 136
user207421 Avatar answered Dec 07 '25 00:12

user207421