[zeromq-dev] JeroMQ subscriber doesn't work

Santosh_Bidaralli at Dell.com Santosh_Bidaralli at Dell.com
Mon Nov 24 21:07:11 CET 2014


I think you are setting the socket option after connecting, please move the following code before connect and try.


Santosh Bidaralli

From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Ole Jørgen Legård
Sent: Monday, November 24, 2014 1:09 PM
To: zeromq-dev at lists.zeromq.org
Subject: [zeromq-dev] JeroMQ subscriber doesn't work

I'm trying to use JeroMQ in an android application to subscribe to events (pusblish) done on another computer on the LAN. The problem is that the android application doesn't receive anything.

Other application on my computer using C# and NetMQ works fine.

Here is the setup of the subscriber:

    class ZeroMQThread extends Thread
        private static final String INNER_TAG = "ZeroMQThread";

        public void run() {
            ZMQ.Context context = ZMQ.context(1);
            ZMQ.Socket subscriber = context.socket(ZMQ.SUB);
            String connectTo = "tcp://<>";

            while (mIsServiceRunning) {
                byte[] msg = subscriber.recv(0);
                Log.d(INNER_TAG, msg.toString());
            subscriber.close ();
            context.term ();

It never returns from subscriber.recv(0). What could I be doing wrong? The publisher is running ZeroMQ 4.0.3.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20141124/d78c9e50/attachment.htm>

More information about the zeromq-dev mailing list