[zeromq-dev] Connecting to a different socket after connecting and sending messages to one socket?

Martin Sustrik sustrik at 250bpm.com
Sat Nov 20 18:32:50 CET 2010


Praveen,

>     My doubt is not about the architecture needed but in regard to any
>     ZMQ socket in general. Can a ZMQ socket be connected to a new end
>     point after it has started receiving messages from prior connected
>     sockets. For example can a SUB socket connect to a new PUB socket
>     apart from the PUB sockets its already connected, especially after
>     receiving some messages from the prior connected PUB SOCKETS?
>
>
> With the current APIs this is not possible.  But 0MQ sockets are
> lightweight, so why not just create a new one for the new peer?

It should be possible to do something like:


zmq_connect (s, ...);
zmq_recv (s, ...);
zmq_connect (s, ...);

However, the new connect doesn't cancel the previous one. So you'll end 
up with a SUB socket connected to tho PUB sockets.

Martin



More information about the zeromq-dev mailing list