[zeromq-dev] How to create an efficient ZMQ message receiver in C#?
Doron Somech
somdoron at gmail.com
Wed Apr 9 18:14:41 CEST 2014
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 <mkluwe at gmail.com> 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
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140409/e5774f30/attachment.htm>
More information about the zeromq-dev
mailing list