[zeromq-dev] Difference between NetMQ and jeromq

Diego Duclos diego.duclos at palmstonegames.com
Wed Dec 4 11:55:34 CET 2013


Can you try calling AddTimer(new NetMQTimer(100)); on the Poller before
starting it ?


On Wed, Dec 4, 2013 at 9:22 AM, Daniel Cleyne <D.Cleyne at qsrinternational.com
> wrote:

>  Folks,
>
>
>
> We are just starting out with ZMQ and have been working with Pub/Sub
> examples to help us in one of our applications. I wrote a Java test
> application and it works ok on the subscribe side. I’ve spend today trying
> to port it to NetMQ without any success. Doesn’t matter what I try with the
> subscription calls on the socket, I don’t get messages. I’ll post the code
> from the different languages in the hope that someone can tell me what I’m
> doing wrong…
>
>
>
> Java (using jeromq):
>
>         *public* *void* run()
>
>         {
>
>                 _Running = *true*;
>
>
>
>                 Context context = ZMQ.*context*(2);
>
>                 ZMQ.Socket socket = context.socket(ZMQ.*SUB*);
>
>                 socket.connect (_ConnectionString);
>
>
>
>                 socket.subscribe(*new* *byte*[0]);
>
>
>
>                 *while* (_Running)
>
>                 {
>
>                         ByteBuffer reply = ByteBuffer.*wrap*
> (socket.recv(0));
>
>                         *if* (reply.hasRemaining())
>
>                         {
>
>                                 reply.order(ByteOrder.*BIG_ENDIAN*);
>
>
>
>                                 *switch* (reply.getInt())
>
>                                 {
>
>                                 *case* 0:
>
>                                         notifyStatusMessage(reply);
>
>                                         *break*;
>
>                                 *case* 1:
>
>                                         notifyLogMessage(reply);
>
>                                         *break*;
>
>                                 }
>
>                         }
>
>                 }
>
>
>
>                 socket.close();
>
>                 context.term();
>
>         }
>
>
>
>
>
> C-Sharp (using NetMQ)
>
>        public void Start()
>
>        {
>
>               var task = Task.Factory.StartNew(() =>
>
>               {
>
>                      var context = NetMQContext.Create();
>
>                      var socket = context.CreateSubscriberSocket();
>
>                      socket.Connect(_ConnectString);
>
>                      socket.ReceiveReady += socket_ReceiveReady;
>
>                      socket.Subscribe(new byte[0]);
>
>                      _Poller = new Poller();
>
>                      _Poller.AddSocket(socket);
>
>                      _Poller.Start();
>
>               }, _TokenSource.Token);
>
>        }
>
>
>
> Any help would be appreciated.
>
>
>
> Cheers,
>
> Dan
>
>
>
> _______________________________________________
> 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/20131204/9cc11f4a/attachment.htm>


More information about the zeromq-dev mailing list