[zeromq-dev] ZeroMQ multiple sockets connection in Java
Check Peck
comptechgeeky at gmail.com
Sat Nov 15 19:53:09 CET 2014
I am working with ZeroMQ sockets (https://github.com/zeromq/jeromq) in Java
for the first time and I need to push my byte array to multiple socket
ports. I know how to send to one socket as shown below -
ZMQ.Context context = ZMQ.context(1);
ZMQ.Socket socket = context.socket(ZMQ.PUSH);
socket.connect("tcp://localhost:5700");
byte[] byteArray = generateRandomDataAsBytes();
ZMsg req = new ZMsg();
req.add(byteArray);
req.send(socket);
But how do I send to multiple socket ports? I need to connect to below
multiple ports and send the data as well -
tcp://localhost:5700
tcp://localhost:5701
tcp://localhost:5702
tcp://localhost:5703
What is the right way to do this using jeromq?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20141115/c77f9d5e/attachment.htm>
More information about the zeromq-dev
mailing list