Clrzmq Socket.ReceiveReady event not generated

I'm having trouble understanding the socket.ReceiveReady event in clrzmq (3.0.0 rc1). In C # idiomatic code, I would wait for the event handler to register, and then sit back and wait for the handler to call:

socket.ReceiveReady += (o, e) => Console.WriteLine ("Success!");

However, this event never rises unless I also actively poll:

var poller = new Poller( new[] {socket} );
while (true) {
    poller.Poll();
}

This is completely counterintuitive to me: I have to either poll (for example, use a pull-based model) or listen to the event (i.e. use a push-based model).

So is this really the right approach, or am I missing something simpler?

+4
source share
1 answer

, . NetMQ NetMQSocket.Poll() Poller.Start(). , .

+4

All Articles