Zeromq broadcasts throughout the network

I am new to ZeroMQ (and programming with sockets in general), but I'm trying to implement (in Java) a peer-to-peer model in ZeroMQ. I would like that when entering the node system it broadcasts the entire network: "I am here and you can contact me at this address: ...".

I think that if 2 or more nodes appear on the network, they can find each other without going through a known endpoint.

Does anyone have any ideas on how I can achieve this? Is this possible with ZeroMQ?

+5
source share
3 answers

, , zmq. ( ), "", , .

- , XPub XSub ( ), " ", REQ/REP. ( ), / ( ).

+4

, UDP:

  • UDP
  • node UDP ( , ), ,
  • , zmq, .

, , https://github.com/stanwu/udp-broadcast

  • IP 192.168.1.10/11/12
  • 192.168.1.10 192.168.1.11 start./udpServer
  • 192.168.1.12 . /udpClient 192.168.1.0 I-AM-HERE-192.168.1.12-PORT-7777
  • 192.168.1.10/11 , 192.168.1.12, - 7777
0

I am using UDP for this on an existing system on a local network. This works well. The only problems you should look into is that UDP packets do not guarantee delivery. They will really be lost, so you will need to participate in re-broadcasts. You also get packet fragmentation, so make sure the messages are small, but you need to send enough information to establish a connection for ZMQ or TCP, or RabbitMQsomething else. Other potential problems are firewalls and VPNs.

0
source

All Articles