[zeromq-dev] Cinder-ZeroMQ block
Sridhar Anandakrishnan
sxa17 at psu.edu
Fri Nov 13 20:11:34 CET 2015
here is a stub:
zmq_pollitem_t items[] = {
{ mtySock, 0, ZMQ_POLLIN, 0 }, // moriarty (req/rep socket)
{ pktSUB, 0, ZMQ_POLLIN, 0 }, // raw packets (sub socket)
{ zyreStatusSock, 0, ZMQ_POLLIN, 0 }, // zyre status (sub socket)
{ NULL, inotifyFD, ZMQ_POLLIN, 0 } // inotify (unix file desc)
};
int npoll = sizeof(items) / sizeof(items[0]);
int timeout = 1000;
while(!zctx_interrupted) {
ret = zmq_poll (items, npoll, timeout);
if (ret == 0) {
// timeout
}
if (ret < 0) {
if(zctx_interrupted)
syslog(LOG_INFO, "zmq_poll received interrupt - exiting.");
break;
}
if (items[0].revents == ZMQ_POLLIN) {
// handle REQ-REP
}
if (items[1].revents == ZMQ_POLLIN) { // handle pkts
// get a packet
}
and so on..
Sridhar
> On Nov 13, 2015, at 2:02 PM, Bruce Lane <brucelane06 at gmail.com> wrote:
>
> thank you Pieter, could you point me to the right sample for polling?
>
> On 13 November 2015 at 16:58, Pieter Hintjens <ph at imatix.com> wrote:
> You should poll the socket and only receive when there is input.
>
> On Fri, Nov 13, 2015 at 2:06 PM, Bruce Lane <brucelane06 at gmail.com> wrote:
> > hi,
> > I'm building this block https://github.com/brucelane/Cinder-ZeroMQ for the
> > Cinder C++ framework.
> >
> > what is the way to use a zeroMQ responder without the execution paused at
> > zmq_recv (responder, buffer, 10, 0)?
> > Shall I use a separate thread or there is another way, like something else
> > than a responder?
> >
> > Bruce
> >
> >
> > _______________________________________________
> > 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
More information about the zeromq-dev
mailing list