[zeromq-dev] ZMQ_FD with request sockets

Yi Ding yi.s.ding at gmail.com
Thu Dec 8 16:59:17 CET 2011


Hi everyone,

New Zeromq user here.  Please bear with me if the answer to this
question is blindingly obvious.

I'm trying to use zeromq with select/epoll so that I can have a single
thread multiplex between different inputs.  After reading the
documentation on ZMQ_FD, I found that it works for ZMQ_REP sockets but
not for ZMQ_REQ sockets.

I've basically modified the hello world server and client (the waitForIt
function is the same in both files):

Server code: http://pastebin.com/eBNaSVYC
Client code: http://pastebin.com/ivt1xfa0

What happens is that the server (ZMQ_REP) gets the request and sends a
reply, but the client (ZMQ_REQ) never gets signaled for the reply, so
the select times out.

If we change the client to not use select, or use the default client,
everything works fine.
Working client code: http://pastebin.com/sg5QyZC2

Reading through the list, I also tried changing the client from ZMQ_REQ
to ZMQ_DEALER, but that didn't work either.

Does anyone know why the file descriptor for ZMQ_REP gets triggered but
the file descriptor for ZMQ_REQ does not?  Is this a bug, or am I doing
something wrong?

I'm running ZeroMQ 2.1.10 on Linux with GCC 4.4.

Thanks in advance,
Yi



More information about the zeromq-dev mailing list