[zeromq-dev] zyre and zmq_poll problem

KIU Shueng Chuan nixchuan at gmail.com
Thu Sep 11 15:19:06 CEST 2014


zmq_poll() takes libzmq void* sockets not zsock_t* that is the type of your
nodesock.

A web search of errno 88 says it's ENOTSOCK.
On 11 Sep 2014 20:04, "Sridhar Anandakrishnan" <sxa17 at psu.edu> wrote:

>
> Hi, I am trying to poll on a zyre socket and it returns immediately with
> errno set to 88.
>
> zyre version is 1.1.0 and libzmq is 4.1.0
> Here is the output of the code (snippet below):
> ---
> zyre: 1 1 0
> zmq: 4 1 0
> I: 14-09-10 11:01:57 (pine07) JOIN group=GLOBAL
> zmq_poll err, 88
> ---
>
> If I use zpoller the poller works properly for the zyre socket alone, but
> according to the docs, in order to use both a zmq socket and a file
> descriptor, I need to use zmq_poll()...
>
> Any help appreciated.
> Sincerely,
> Sridhar
>
>
> serfd opens /dev/null in this case for testing...
>
>     zyre_version(&major, &minor, &patch);
>     fprintf(stderr, "zyre: %d %d %d\n", major, minor, patch);
>     zmq_version(&major, &minor, &patch);
>     fprintf(stderr, "zmq: %d %d %d\n", major, minor, patch);
>
>     zyre_t *node = zyre_new("pine07");
>     assert(node);
>     zyre_set_verbose(node);
>     //zyre_set_name(node, "pine07");
>     ret = zyre_start(node);
>     assert(ret==0);
>     zyre_join(node, "GLOBAL");
>
>     zsock_t *nodesock = zyre_socket(node);
>
>     zmq_pollitem_t items[] = {
>                 { NULL, serfd, ZMQ_POLLIN, 0},
>                 { nodesock, 0, ZMQ_POLLIN, 0}
>     };
>     int npoll = sizeof(items) / sizeof(items[0]);
>     int timeout = 60000; // FIXME - define?
>
>     while(1) {
>         static char *sender, *ipaddr, *base = NULL, *hdr, *name;
>         char *msgstring;
>         zmsg_t *msg;
>         ret=zmq_poll(items, npoll, timeout);
>         if(ret<0) {
>                 fprintf(stderr, "zmq_poll err, %d\n", errno);
>         }
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140911/cf8e6686/attachment.htm>


More information about the zeromq-dev mailing list