[zeromq-dev] socket call back when using the zmq_loop
Martin Sustrik
sustrik at 250bpm.com
Fri Dec 18 17:26:06 CET 2009
Hi Sebastien,
> I playing with zeromq 2.0 and I would like to read/write several zmq
> socket in the same thread. I saw an interesting function call loop but I
> don't know how to register callback on zmq socket. Is there a way to do
> that or must I call explicitly zmq_poll with my zmq socket list?
There are no callbacks in 0MQ so when dealing with several sockets you
have to use zmq_poll.
However, each 0MQ socket can actually manage arbitrary number of
underlying POSIX sockets, e.g. server application handling 10,000 client
connections needs only a single 0MQ socket.
Also, single socket can be used to talk to serveral destinations, i.e.
you can do arbitrary number of zmq_bind's and zmq_connect's on a single
0MQ socket.
The only case where you need multiple 0MQ sockets is when using multiple
messaging patters simultaneously from the same thread, say both
request/reply and publish/subscribe.
HTH,
Martin
More information about the zeromq-dev
mailing list