Reputation: 23
I've got 12 "node" embedded machines that I want send a message to from my server machine. I don't know their IP address, they don't know mine. Is there a way I can "broadcast" a tcp message over the local network so that they can all receive it on a certain port?
So far, I’ve tried a pub/sub connection with 12 nodes as publishers & the "server" as the subscriber. I've heard that you can use 0.0.0.0 to listen for all IP addresses incoming, and you can use * to broadcast to anyone who'll listen.
#On the "server"
socket = context.socket(zmq.PUB)
socket.bind("tcp://*:{port}")
#On the "node"
socket = context.socket(zmq.SUB)
socket.connect("tcp://0.0.0.0:{port}")
This works great for testing when the publisher & subscriber are the same machine, but fails when executed on different machines (the message is not never received). What am I doing wrong here? Might it have something to do with my firewall?
[If it matters, I'm using python 2 on a MacBook and Linux/ARM nodes]
Upvotes: 2
Views: 1823
Reputation: 8414
The ZeroMQ Guide to Peer to Peer networking goes down the line of using raw UDP to discover peers. You're probably going to have to do something along those lines.
Upvotes: 1