pollernetmq

Socket.ReceiveReady is not fired despite available messages


I've started to explore NetMQ 3.3.0.11 and ran into an issue with the use of Poller.

I try to achieve that the poller polls for about 1s and then stops and allows something else to be done before it resumes polling for 1s and so on.

I have the following code:

var poller = new Poller (client) { PollTimeout = 10 };

while (true)
{                    
    for (var poll = 0; poll < 100; poll++)
    {
       poller.PollOnce ();
    }

    do_something;
}

The problem I'm facing is that during that polling period the Client.ReceiveReady event is not fired even though a message is ready to be picked up. And a InvalidOperationException stating Poller is started is raised.

Any idea what I'm doing wrong?


Solution

  • First try to work with version 3.3.0.12-rc1, it fixes a lot of issues, probably also the one you are suffering from.

    Also regarding the do_something, I suggest working with NetMQTimer instead of PollOnce (use PollTillCanceled instead). You can also use NetMQScheduler for the do something stuff.