Simple UDP broadcast client and server on different machines

后端 未结 2 973
滥情空心
滥情空心 2021-01-02 04:29

The following client and server UDP broadcast code works on fine when both are on the same PC. However when I have them on separate PC\'s in the same WIFI LAN nothing happe

相关标签:
2条回答
  • 2021-01-02 05:09

    To actually broadcast you must send the packet to all the IP on the LAN. The range of possible IP is from 0.0.0.0 to 254.254.254.254 but to select all of them you could write: 255.255.255.255. But most of the routers will block this. They will allow something like 192.168.1.255 witch broadcasts to all the 255 ip from 192.168.1.0 to 192.168.1.254 which is what you need, I think.

    0 讨论(0)
  • 2021-01-02 05:18

    Is hostname localhost? If so, you can not reach other pc. You must change it with target IP address.

    0 讨论(0)
提交回复
热议问题