[zeromq-dev] ZMQ_FD with request sockets
Francois-Xavier Bourlet
fx at dotcloud.com
Thu Dec 8 20:33:40 CET 2011
Hi,
The keyword is: edge-triggered.
You need to wait only if you can't read anything from the socket
anymore. To do so, always read using NOBLOCK, and in the case you get
a TRYAGAIN error, then you wait via your select/ioloop whatever.
Regards,
On Thu, Dec 8, 2011 at 7:59 AM, Yi Ding <yi.s.ding at gmail.com> wrote:
> 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
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
--
François-Xavier Bourlet
More information about the zeromq-dev
mailing list