[zeromq-dev] What are the “serious caveats” with ZMQ_FD?

Jim Hague jim.hague at acm.org
Tue May 3 00:38:18 CEST 2016

On Saturday 30 Apr 2016 19:32:56 Kalle Huttunen wrote:
> I've prototyped integrating ZeroMQ socket receiving to Qt's and custom
> select() based event loops, and on the first glance everything seems to
> work.
> From the documentation I have identified two "caveats" that I handle in my
> code [...]
> Are there some caveats that I'm missing?

One little thing that tripped me up. If you're using PGM, sending though a PUB 
and listening for incoming traffic on a SUB, you might think you only need to 
monitor the FD on the SUB socket. In fact any NAK from a client gets sent to 
the PUB socket, so you need to monitor it's FD for incoming traffic too. Using 
either to trigger calling zmq_poll() on the SUB socket will get NAK responses 
sent properly.

If you don't monitor the PUB socket FD, only call zmq_recv() or zmq_poll() on 
an event, and don't have any traffic to zmq_send(), PGM NAKs won't get 
Jim Hague - jim.hague at acm.org          Never trust a computer you can't lift.

More information about the zeromq-dev mailing list