Hi,

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

            subscriber.subscribe(ZMQ.SUBSCRIPTION_ALL);

Thanks,
Santosh Bidaralli

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

Hi
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() {
            this.setName(INNER_TAG);
            ZMQ.Context context = ZMQ.context(1);
            ZMQ.Socket subscriber = context.socket(ZMQ.SUB);
            String connectTo = 
"tcp://10.200.20.10:5558<http://10.200.20.10:5558>";
            subscriber.connect(connectTo);
            subscriber.subscribe(ZMQ.SUBSCRIPTION_ALL);

            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.


_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to