CloudburstMC / Protocol

A protocol library for Minecraft Bedrock Edition
https://git.io/ProtocolLib
Apache License 2.0
312 stars 94 forks source link

When bound to an IP, LAN broadcasts are no longer recieved #71

Open bundabrg opened 4 years ago

bundabrg commented 4 years ago

As per a discussion in Discord when the BedrockServer is bound to an IP instead of 0.0.0.0 it will no longer see broadcast packets and thus not pick up on LAN broadcasts.

A possible solution is to bind to 0.0.0.0 using a MulticastSocket (as opposed to a DatagramSocket) which allows multiple listeners which will receive all broadcast traffic when a specific IP is set in addition to the IP to receive unicast traffic.

jimbt commented 4 years ago

I think an enhancement to RakNetServer::bindInternal to recognize when binding to a specific IP, instead of 0.0.0.0 (i.e. bind all), and including that IP's broadcast IP in channelFutures[]. This would potentially require a thread to handle the one additional broadcast IP.