Multiplayer Issue - Broadcasting PacketPeerUDP when the subnet mask is

Godot Version



Currently I am able to successfully create a LAN server browser with the tutorial provided by “FinePointCGI” on YouTube, the video is called “Creating a LAN Multiplayer Server Browser in Godot 4!” There’s a limitation to the demonstrated method though - broadcasting your UDP packages only works when your subnet mask is, which is usually the case with the smaller local networks. My University’s subnet mask is, so broadcasting does not work.

For reference, I use code

broadcaster =
	broadcaster.set_dest_address(broadcast_adress, listen_port)

which works when I am at home, and:

broadcast_adress =

and does not work when I am at University and use

broadcast_adress =


broadcast_adress =

You can likely detect the correct subnet mask to use based on the local IP address, which you can retrieve using IP.get_local_addresses(). You’ll have to filter the returned array to contain only addresses that start with 10., 172.16. and 192.168., then pick the first one in the array (in case there are multiple). This won’t be 100% reliable though and will require some finetuning.

However, on your university’s network, you’ll hit another problem: firewalls. University and corporate networks generally block a lot of ports, especially UDP ports as these are associated with gaming. You’ll have to look into using a VPN to avoid port restrictions (at your own risk).

1 Like