[zeromq-dev] PUB socket, EPGM and zmq_poll()

Jim Hague jim.hague at acm.org
Thu Nov 26 17:58:12 CET 2015


On Wednesday 25 Nov 2015 18:07:41 Jim Hague wrote:
> I'm using a PUB socket with EPGM to multicast low volume data to clients
> listening with a SUB. The sender listens for incoming data on a PULL socket,
> which it integrates into an existing event loop by adding underlying fds
> from zmq_getsockopt(ZMQ_FD) into the event loop, and when one fires
> checking activity with zmq_poll().
> 
> I have found that the sender is not reacting to PGM NAKs. A bit of googling
> suggests that the sender needs to call pgm_recv() to trigger sending the NAK
> responses.
> 
> So I'm guessing that I need to include the fd for the PUB socket in the
> event loop. Does that sound right?

Answering my own question, in case it's useful for someone else.

It appears that if you want (E)PGM NAKs processed immediately on receipt, you 
do need to incorporate the sending PUB socket fds into your event loop, and 
then when one fires call zmq_poll() on any PGM socket. As it happens, I 
already had a SUB socket in the sockets examined by zmq_poll(), so just adding 
the PUB socket fds to my event loop handler got NAK reponses working.

Judging from my other tests, NAK processing will also be fired the next time 
any activity (including poll) occurs on a ZMQ PGM socket. Certainly tests 
sending data at 5s intervals from PUB to SUB via EPGM showed data being 
transferred reliably across a WAN, so I guess NAK processing much have been 
happening. 
-- 
Jim Hague - jim.hague at acm.org          Never trust a computer you can't lift.




More information about the zeromq-dev mailing list