[zeromq-dev] ZMQ dealer not receiving message from ZMQ router with ZMQ_FD

Kah-Chan Low kahchanlow at yahoo.com
Wed Oct 31 20:02:49 CET 2012

Thanks Paul!

I followed your advice and checked for ZMQ_EVENTS after each each zmq_send() and it worked!

I am still puzzled.
1. Checking for ZMQ_EVENT somehow resets the trigger, even if there is no message to be read.  Why is this necessary?
2. ZMQ router does not need checking  ZMQ_EVENT after zmq_send() for the read trigger to work properly.  Why?

 From: Paul Colomiets <paul at colomiets.name>
To: Kah-Chan Low <kahchanlow at yahoo.com>; ZeroMQ development list <zeromq-dev at lists.zeromq.org> 
Sent: Wednesday, October 31, 2012 4:44 AM
Subject: Re: [zeromq-dev] ZMQ dealer not receiving message from ZMQ router with ZMQ_FD

On Wed, Oct 31, 2012 at 5:03 AM, Kah-Chan Low <kahchanlow at yahoo.com> wrote:
> I have read about the caveats of using ZMQ_FD so once an event is triggered,
> I do use ZMQ_EVENTS to test for ZMQ_POLLIN before calling zmq_recv()
> I also make use that I read all messages off a socket once a read event i
> triggered.
> [...]
> I have read that some people had similar problems and they were advised to
> keep reading until EAGAIN before calling select(). I can't do that since the
> ZMQ dealer is only one of a number of sockets owned by the thread and any
> one of them may receive a message at any time.

I'm not sure how those two paragraphs are connected. Do you check for
ZMQ_EVENTS until it gets becomes unreadable, instead of doing zmq_recv
until EAGAIN?

If you are, that's ok. You must also check for ZMQ_EVENTS after each
zmq_send, before calling select.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20121031/f6989220/attachment.htm>

More information about the zeromq-dev mailing list