Your snippet neither initializes nor checks poll_items[1]. But no, revents field doesn't need to be reset (nor initialized).
On Tue, Aug 19, 2014 at 8:14 AM, Badhrinath Manoharan <badh...@gmail.com> wrote: > Hi, > > I have the following topology > > Client ---> Broker ----> Server > > Both the client and server are sockets of type ZMQ_REQ while the Broker > has a socket connected to client and another Socket Connected to Server > both are of type ZMQ_BROKER. > > void *frontend = zmq_socket (context, ZMQ_ROUTER); > void *backend = zmq_socket (context, ZMQ_ROUTER); > > zmq_bind(frontend, "ipc:///users/badmanoh/frontend.ipc"); > zmq_bind(backend, "ipc:///users/badmanoh/backend.ipc"); > > poll_items[0].socket = frontend; > poll_items[0].fd = 0; > poll_items[0].events = ZMQ_POLLIN; > poll_items[0].revents = 0; > > poll_items[0].socket = backend; > poll_items[0].fd = 0; > poll_items[0].events = ZMQ_POLLIN; > poll_items[0].revents = 0; > > while (1) { > ret = zmq_poll(poll_items, 2, -1); > if (ret == -1) { > printf("zmq_poll returned -1. Error: %d\n", errno); > return 0; > } > if (poll_items[0].revents & ZMQ_POLLIN) { > } > if (poll_items[0].revents & ZMQ_POLLIN) { > } > } > > On the broker code, I have a zmq_poll(poll_items, 2, -1) on a while loop. > I see the zmq_poll notifying the first message from each socket. However > subsequent messages from both the client or server sockets are not at all > returned and the zmq_poll just stays in an infinite loop. Could you let us > know if I am missing anything? Do I need to reset the revents value as part > of the first notification? > > Thanks > Badhri > > _______________________________________________ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > >
_______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev