Hi all,

I'm wondering what is the best approach to polling a non-zmq socket using czmq. It doesn't seem documented?

I can add a fd as follows:

...
s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
zpoller_add(poller, &s);
...

If I then poll zpoller_wait returns on activity however it's not a valid zsock_t instance:

zsock_t *which = (zsock_t *)zpoller_wait(poller, -1);

zsock_is(which) will return false. I've found 'which' is just what you added to the poller so if I cast to an int it will resolve to the correct filedescriptor number.

So either I cast it back to an int or I keep checking the pointer addresses. However casting an int to zsock_t doesn't feel safe.

So question is what is best/safest approach?

Rg,

Arnaud
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
https://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to