table of contents
other versions
- wheezy-backports 3.2.3+dfsg-2~bpo70+1
- jessie 4.0.5+dfsg-2+deb8u1
- testing 4.2.1-4
- unstable 4.2.1-4
ZMQ_POLL(3) | 0MQ Manual | ZMQ_POLL(3) |
NAME¶
zmq_poll - input/output multiplexingSYNOPSIS¶
int zmq_poll (zmq_pollitem_t *items, int nitems , long timeout);DESCRIPTION¶
The zmq_poll() function provides a mechanism for applications to multiplex input/output events in a level-triggered fashion over a set of sockets. Each member of the array pointed to by the items argument is a zmq_pollitem_t structure. The nitems argument specifies the number of items in the items array. The zmq_pollitem_t structure is defined as follows:typedef struct { void *socket; int fd; short events; short revents; } zmq_pollitem_t;
For 0MQ sockets, at least one message may be
received from the socket without blocking. For standard sockets this is
equivalent to the POLLIN flag of the poll() system call and
generally means that at least one byte of data may be read from fd
without blocking.
ZMQ_POLLOUT
For 0MQ sockets, at least one message may be
sent to the socket without blocking. For standard sockets this is
equivalent to the POLLOUT flag of the poll() system call and
generally means that at least one byte of data may be written to fd
without blocking.
ZMQ_POLLERR
For standard sockets, this flag is passed
through zmq_poll() to the underlying poll() system call and
generally means that some sort of error condition is present on the socket
specified by fd. For 0MQ sockets this flag has no effect if set in
events, and shall never be returned in revents by
zmq_poll().
RETURN VALUE¶
Upon successful completion, the zmq_poll() function shall return the number of zmq_pollitem_t structures with events signaled in revents or 0 if no events have been signaled. Upon failure, zmq_poll() shall return -1 and set errno to one of the values defined below.ERRORS¶
ETERMAt least one of the members of the
items array refers to a socket whose associated 0MQ
context was terminated.
EFAULT
The provided items was not valid
(NULL).
EINTR
The operation was interrupted by delivery of a
signal before any events were available.
EXAMPLE¶
Polling indefinitely for input events on both a 0MQ socket and a standard socket..zmq_pollitem_t items [2]; /* First item refers to 0MQ socket 'socket' */ items[0].socket = socket; items[0].events = ZMQ_POLLIN; /* Second item refers to standard socket 'fd' */ items[1].socket = NULL; items[1].fd = fd; items[1].events = ZMQ_POLLIN; /* Poll for events indefinitely */ int rc = zmq_poll (items, 2, -1); assert (rc >= 0); /* Returned events will be stored in items[].revents */
SEE ALSO¶
zmq_socket(3) zmq_send(3) zmq_recv(3) zmq(7)AUTHORS¶
This 0MQ manual page was written by Martin Sustrik < sustrik@250bpm.com[1]> and Martin Lucina < mato@kotelna.sk[2]>.NOTES¶
- 1.
- sustrik@250bpm.com
mailto:sustrik@250bpm.com
- 2.
- mato@kotelna.sk
mailto:mato@kotelna.sk
05/02/2013 | 0MQ 3.2.2 |