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 <[email protected]>
To: Kah-Chan Low <[email protected]>; ZeroMQ development list
<[email protected]>
Sent: Wednesday, October 31, 2012 4:44 AM
Subject: Re: [zeromq-dev] ZMQ dealer not receiving message from ZMQ router with
ZMQ_FD
Hi,
On Wed, Oct 31, 2012 at 5:03 AM, Kah-Chan Low <[email protected]> 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.
--
Paul
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev