Simple UDP broadcast client and server on different machines

后端 未结 2 985
滥情空心
滥情空心 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.

提交回复
热议问题