[zeromq-dev] C++, socket_t, and poll - Email found in subject

David Hait dhait at optionmetrics.com
Wed Oct 27 18:47:36 CEST 2010


> > Yes, but once you receive the notification, and you have the
> item.socket (which is a void*), how do you cast this back to a
> socket_t?  There is no constructor for socket_t which takes a void*.
> >
> That would mean several socket_t's pointing to the same socket. That in
> turn would require reference counting etc.
> 
> It's simple: If you've extracted pollitem no.3 from socket S and then
> you got event on pollitem no.3, it means that the event happened on
> socket S.

Yes, but this means that if I have multiple socket_t's which are being polled, I need to keep two separate arrays: an array of the socket_t's and an array of pollitem_t, in order to cross-reference the two.  It would be nice if I didn't need this extra socket_t array.  A cast/constructor would solve this problem; or alternatively a zmq::poll() function which allowed socket_t's to be part of the pollitem_t structure.



More information about the zeromq-dev mailing list