[zeromq-dev] polling in jeromq
ashwini ramamurthy
ashwini.ram21 at gmail.com
Thu Jul 18 17:10:33 CEST 2013
Hi ,
I am learning to use zeromq polling in android . I am polling on a req
socket and a sub socket in the android program(client). So that this client
can receive both reply messages from the server and also published messages.
My polling is not working. Both the req socket and the publish socket does
not get polled in. If i don't use polling both the sockets receive the
message.
I tried searching online but could not find anything relevant.
The client code is this :
public void run()
{
ZMQ.Context context = ZMQ.context(1);
ZMQ.Socket reqsocket = context.socket(ZMQ.REQ);
ZMQ.Socket subsocket =context.socket(ZMQ.SUB);
reqsocket.connect("tcp://10.186.3.174:8081");
subsocket.connect("tcp://10.186.3.174:8083");
subsocket.subscribe("".getBytes());
byte[] receivedmessage;
Poller poller=context.poller();
poller.register(reqsocket,Poller.POLLIN);
poller.register(subsocket,Poller.POLLIN);
reqsocket.send(msg.getBytes(),0);
while(!Thread.currentThread().isInterrupted())
{
if(poller.pollin(0))
{
receivedmessage=s.recv(0);
}
if(poller.pollin(0))
{
receivedmessage=subsocket.recv(0);
}
}
s.close();
context.term();
}
Am i missing out something or doing something wrong? I don't get any
errors.
Thanks
Ashwini
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130718/6dc78474/attachment.htm>
More information about the zeromq-dev
mailing list