I created an Android/Desktop game which supports multiplayer on a local area network. I am using DatagramPackets and right now I have hard coded 2 local IP addresses for testing purposes.
How do I make it so when one device is hosting a game anyone else running the game can detect that hosted game on the LAN. Basically I need to get the Local IP Address of the person who is hosting my game from another device connected to the same router searching for a game on the network.
This is how I am currently detecting the other devices on the network by hard coding the address.
outgoingPacket.setAddress(InetAddress.getByName("192.168.1.20"));
I imagine I should be using a broadcast of some sort.