Added port number randomization

- Servers all run on different ports, so multiple servers can run on one host
- Port is displayed in lobby

Tags: #story[1281]
This commit is contained in:
Michael Rausch
2017-09-28 15:57:59 +13:00
parent 8810554ce9
commit a05a41d5ec
10 changed files with 75 additions and 79 deletions
@@ -165,7 +165,7 @@ public class GameClient {
}
try {
startClientToServerThread(ipAddress, 4942);
startClientToServerThread(ipAddress, server.getPortNumber());
} catch (IOException e) {
showConnectionError("Cannot connect to server as host");
}
@@ -199,8 +199,10 @@ public class GameClient {
this.lobbyController = ViewManager.getInstance().goToLobby(false);
lobbyController.setPortNumber(""+server.getPortNumber());
ViewManager.getInstance().setPlayerList(clientLobbyList);
return new ServerDescription(serverName, regattaData.getCourseName(), GameState.getNumberOfPlayers(), GameState.getCapacity(), ipAddress, 4942);
return new ServerDescription(serverName, regattaData.getCourseName(), GameState.getNumberOfPlayers(), GameState.getCapacity(), ipAddress, server.getPortNumber());
}
private void tearDownConnection() {