sockets - Android Application hanging on subscriber.recv() -


i writing android application receives continuous stream of data. i've set connection inside runnable so:

runnable runnable = new runnable()     {         public void run()         {         zmq.context context = zmq.context(1);         zmq.socket subscriber = context.socket(zmq.sub);         subscriber.connect("tcp://[ip]:[port]");             textview strdisplay = (textview) findviewbyid(r.id.stringdisplay);             while (!thread.currentthread ().isinterrupted ())             {                 // read message contents                 log.i("output", "the while loop ran here");                 //*hangs on line below*                 string testcase = subscriber.recvstr(0);                 strdisplay.settext(testcase);                 log.i("output", "the while loop completed");             } 

now, after scouring of interwebs, i've come 2 conclusions:

1) recvstr() blocking call waits until receives something. means hasn't connected or else

and

2) may have set filter of sort?

i can't figure out should next. experienced jeromq or android server access appreciated

possibly, need subscribe on topic want publisher or subscribe on topics after made connection.

for example subscribing on single topic:

subscriber.subscribe("topic_to_get".getbytes()); 

subscribing on every topic:

subscriber.subscribe("".getbytes()); 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -