2
votes

One server - ZMQ_ROUTER, many clients - ZMQ_DEALER

How on a server(ZMQ_ROUTER) send a message to all clients(ZMQ_DEALER)?

UPD: I know there are PUB-SUB pattern and that is really what I need. But I want to use only the current ROUTER-DEALER socket. Is it possible?

1

1 Answers

5
votes

Yes, but It won't be the answer you would like to hear. I think there isn't a flag, or socket option for this. What you can do:

Track the connected dealers manually, than create a loop and send the same stuff to every connected dealer. If you send large messages you can zero copy the load, so you don't have to allocate the memory time to time.