In NetMQ (.net port of zeromq) you can use Poller, it's blocking as well
but you can use it to receive messages from multiple sockets and also have
built in timers.

To understand how to use it you can take a look at the unit tests of poller
at:
https://github.com/zeromq/netmq/blob/master/src/NetMQ.Tests/PollerTests.cs



On Wed, Apr 9, 2014 at 6:31 PM, Matthias Kluwe <[email protected]> wrote:

> Am 08.04.2014 22:42, schrieb mark:
> > Most trivial ZMQ examples use a spinning loop to receive messages, like
> so:
> >
> > *while (true)*
> > *{*
> > *   // Wait for next request from client*
> > *   string message = server.Receive(Encoding.Unicode);*
> > *   //.....*
> > *}*
> >
> > Which obviously ties up a thread.
> >
> > Is there a better way (preferably in C#) to wait for incoming messages?
>
> In which aspect do you consider this to be inefficient? This handles one
> message after another, and I guess the call to Receive blocks, so the
> loop is not really "spinning".
>
> Regards,
> Matthias
>
>
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to