[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


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: 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

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.


-------------- 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