diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/RMIServer.java b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/RMIServer.java index cf5d600..fdcc868 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/RMIServer.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/RMIServer.java @@ -26,7 +26,7 @@ import java.rmi.*; * Server RMI. Exposes a method to join the game and one to execute an event. */ public class RMIServer extends UnicastRemoteObject implements IGameServer { - + private String host; /** Server game's controller */ private GameController controller; @@ -60,11 +60,12 @@ public class RMIServer extends UnicastRemoteObject implements IGameServer { * @param playerList The player's usernames list * @throws RemoteException if an RMI error occurs */ - public RMIServer(GameController controller, int nPort, BlockingQueue actionQueue,LimitedList playerList) throws RemoteException { + public RMIServer(GameController controller, int nPort, BlockingQueue actionQueue,LimitedList playerList,String host) throws RemoteException { this.controller = controller; this.nPort = nPort; this.actionQueue = actionQueue; this.playerList = playerList; + this.host = host; } @@ -249,9 +250,7 @@ public class RMIServer extends UnicastRemoteObject implements IGameServer { */ public boolean start() { try { - String ip = InetAddress.getLocalHost().getHostAddress(); - System.out.println("Starting RMI Server on IP: " + ip); - System.setProperty("java.rmi.server.hostname", "10.8.0.3"); // o il tuo IP/hostname + System.setProperty("java.rmi.server.hostname", host); // o il tuo IP/hostname registry = LocateRegistry.createRegistry(nPort); registry.rebind("RMIGameServer", this); System.out.println("RMI Server started on port: "+nPort);