[zeromq-dev] Using ZMQ_FD with select

Yi Ding yi.s.ding at gmail.com
Sun Feb 19 16:15:44 CET 2012

On Sun, Feb 19, 2012 at 4:02 AM, Schmurfy <schmurfy at gmail.com> wrote:
> Now I really feel stupid xD
> Thanks for pointing this out, not really intuitive.
> I am back to square one since it does not explain my problem then xD
> But I am curious what was your problem with REQ/REP if not this one because
> I also have problems with REQ/REP where the other sockets type works as
> intended.
> I just can't pinpoint what exactly is wrong and where.

My problems with REQ/REP mainly came from the fact that it enforces
this strict ordering of request, reply, request, reply.  So it's
really meant for synchronous communication, for both the client and
the server.  Trying to get it to work with asynchronous communication
meant that I would have to create my own queues and monitor those, and
make sure not to miss any incoming messages on the select, make sure I
was resetting the edge triggering properly (which is doubly hard
because calling recv too many times on a REQ or REP socket will
trigger EFSM).

Ultimately it turned into too much work.  I've found a pair of
PUSH/PULL sockets works well if the endpoints are all known in
advance.  Other people have suggested ROUTER/DEALER, but I haven't
tried that yet.  Also, if the endpoints aren't known in advance,
PUB/SUB can work, although endpoint discovery is pretty tricky right
now because there's no way to get the IP address off an inbound

More information about the zeromq-dev mailing list