[zeromq-dev] Setting an Android Device as a Subscriber
Marcin Romaszewicz
marcin at brkt.com
Wed Jul 22 03:14:25 CEST 2015
Look here:
https://github.com/zeromq/jeromq/blob/master/src/test/java/guide/psenvsub.java
call:
subscriber.subscribe("foo".getBytes(ZMQ.CHARSET));
On Tue, Jul 21, 2015 at 4:40 PM, Areeb Mehmood <
areeb.mehmood at renovomotors.com> wrote:
> Actually, I've found the zmq.ZMQ.setSocketOption command. The parameters
> are as such:
> setSocketOption(SocketBase s, int option, Object optval). Any guidance on
> what parameters I should put in? I'm expecting a stream of strings from the
> publisher
>
> On Tue, Jul 21, 2015 at 3:00 PM, Marcin Romaszewicz <marcin at brkt.com>
> wrote:
>
>> Subscribers by default (at least in the C++ version of ZMQ) do not
>> subscribe to anything. You need to call zmq_setsockopt(ZMQ_SUBSCRIBE...) to
>> establish a subscription. You probably have to do something similar on the
>> subscriber socket in jeroMQ
>>
>> On Tue, Jul 21, 2015 at 2:21 PM, Areeb Mehmood <
>> areeb.mehmood at renovomotors.com> wrote:
>>
>>> Santosh,
>>>
>>> You mean add filtering on the publisher side?
>>>
>>> - Areeb M.
>>>
>>> On Tue, Jul 21, 2015 at 2:19 PM, <Santosh_Bidaralli at dell.com> wrote:
>>>
>>>> *Dell Customer Communication*
>>>>
>>>> Please add a filtering for the required events and try. Sorry, I don’t
>>>> know much about jeroMQ as I use CZMQ library, hence I don’t know the exact
>>>> syntax for filtering in jeroMQ.
>>>>
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Santosh
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> *From:* zeromq-dev-bounces at lists.zeromq.org [mailto:
>>>> zeromq-dev-bounces at lists.zeromq.org] *On Behalf Of *Areeb Mehmood
>>>> *Sent:* Tuesday, July 21, 2015 4:15 PM
>>>> *To:* zeromq-dev at lists.zeromq.org
>>>> *Subject:* [zeromq-dev] Setting an Android Device as a Subscriber
>>>>
>>>>
>>>>
>>>> Hello ZMQ,
>>>>
>>>> Using Android Studio, and the jeromq-0.3.5.jar library, I am attempting
>>>> to build a mobile application that will subscribe to a publisher that is
>>>> dumping string messages.
>>>>
>>>> Here is what my code looks like on the Subscriber side:
>>>>
>>>> Runnable runnable = *new *Runnable()
>>>> {
>>>> *public void *run()
>>>> {
>>>> ZMQ.Context context = ZMQ.*context*(1);
>>>> ZMQ.Socket subscriber = context.socket(ZMQ.*SUB*);
>>>> subscriber.connect(*"tcp://192.168.1.36:6666 <http://192.168.1.36:6666>"*);
>>>> String testcase = subscriber.recvStr(0);
>>>> TextView strDisplay = (TextView) findViewById(R.id.*stringDisplay*);
>>>> Log.*i*(*"Output"*, *"the testcase recieved something"*);
>>>> strDisplay.setText(testcase);
>>>> Log.*i*(*"Output"*, *"strDisplay was set"*);
>>>> }
>>>> };
>>>>
>>>> The code hangs at:
>>>>
>>>> String testcase = subscriber.recvStr(0);
>>>>
>>>> I am not sure how to resolve this issue as I have tried various things.
>>>> The IP Address and Port are correct, and the publisher is running. I can
>>>> also provide the publisher side code if you need.
>>>>
>>>> _______________________________________________
>>>> zeromq-dev mailing list
>>>> zeromq-dev at lists.zeromq.org
>>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>>
>>>>
>>>
>>> _______________________________________________
>>> zeromq-dev mailing list
>>> zeromq-dev at lists.zeromq.org
>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>
>>>
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>>
>
> _______________________________________________
> 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/20150721/a68d257a/attachment.htm>
More information about the zeromq-dev
mailing list