Hi,

You need to call poller.poll(timeout) before you call poller.pollin

Thanks
Min

On Jul 19, 2013, at 12:10 AM, ashwini ramamurthy <[email protected]> 
wrote:

> 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
> 
> 
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

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

Reply via email to