0

I'm making a game using Slick2D for game-logic and Kryonet for networking. The game can be played in 2-player multiplayer through LAN, where one player is the host-server and the other player is a client that receives information on what to render.

When setting up the host, the first player enters a name for the server and then the second player (client) should search for servers over LAN on that specific port. My problem is that I am only aware of Kryonet's host discovery built-in method

InetAddress address = client.discoverHost(54777, 5000);

Which will find the first server running over LAN on the specified port. However, once I check this server and send a packet confirming the name, if it doesn't match, how can I find another server without finding the same server that I just checked?

gurdingering
  • 207
  • 5
  • 12

1 Answers1

0

Nevermind! Just looked more closely at the Kryonet library and saw that discoverHosts() has another method that returns a list of InetAddresses. I think I can just go through the addresses, send packets confirming the name, and when I hit a correct server, keep that connection.

gurdingering
  • 207
  • 5
  • 12