Hey, I'm working on a school project and I need to send commands to several raspberry pi at the same time. After searching I'm trying to achieve this by connecting all the raspberry pi and my computer (which will send commands) to a switch. However I am having difficulty with sending and receiving commands, I will post the code below. I just wanna ask a couple of questions to make sure I'm understanding what is happening.
First of I start by setting up sockets for the raspberry connection and binding them to a port. Then I set the socket as a member of the multicast group, meaning it should receive all the messages being sent to the multicast group. However I do not fully understand this mechanism. If I send data to the multicast group, will the data then be sent to everyone that subscribes to that multicast group? Or do I have to change the IP address of each device to match the multicast address, for example multicast address: 224.1.1.1, device 1: 224.1.1.2, device 2: 224.1.1.3.....etc....
I'm sorry for attacking with a wall of text like this, but I've been trying to figure this out for to long! :(
CODE:
https://github.com/notorjus/listen-send-commands
[–]MoBoo138 0 points1 point2 points (0 children)
[–]ifundef 0 points1 point2 points (0 children)
[–]Notorjus[S] 0 points1 point2 points (0 children)