Closed martynaskre closed 5 years ago
For example, to send a broadcast to all hosts on the network identified by IP addresses starting with 192.168.1, use the address 192.168.1.255.
As I understand its universal on Windows. Quote from here.
The text you quoted explicitly says, that this only works for IP addresses starting with 192.168.1
, which means that it does not work for any other addresses. If someones computer has the address 10.0.0.5
for example, sending a UDP packet to 192.168.1.255
would not work. That's what I meant when I said it's not universal. It might work for your configuration, but it wouldn't work for me for example, since my devices are on the 192.168.0.255
subnet.
I think the solution is to identify network address, for example if its 192.168.1.x
or 192.168.0.x
and add 255 in the end. I dont know much about networking, but it should be universal on Windows. What do you think?
You probably have to do some workaround, by working with the output of os.networkInterfaces() and replacing the last bytes of the IP addresses or something.
This is exactly what I proposed two days ago and yes, I think this approach is the way to go.
192.168.1.255
might be your local broadcast address, but that is in no way a universal solution. Like I said in my comment, you need to take a look at all the interface addresses and broadcast on every one of them. Sorry, but I can't merge this PR in the current state.