Fixed: RMI?

This commit is contained in:
rubenpirreram
2026-05-17 18:12:32 +02:00
parent 0c1fc8ab98
commit 4c3d9ac7b8
3 changed files with 5 additions and 0 deletions
@@ -63,6 +63,7 @@ public class ClientLauncherTUI {
int networkType = scanner.nextInt();
System.out.println("Insert server IP: ");
String IP = scanner.next();
System.setProperty("java.rmi.server.hostname", IP);
// RMI
if (networkType == 0) {
// Connect
@@ -208,9 +208,11 @@ public class ServerLauncher {
boolean serverCrashed;
try {
IP=chooseNetworkInterface(new Scanner(System.in));
System.out.println(IP);
} catch (Exception e) {
throw new RuntimeException(e);
}
System.setProperty("java.rmi.server.hostname", IP);
RMIServer serverRMI = new RMIServer(gameController, 1099, actionQueue, playerList,IP);
TCPServer serverTCP = new TCPServer(gameController, 8080, 8081,actionQueue, playerList);
@@ -254,6 +256,7 @@ public class ServerLauncher {
serverRMI.start(serverCrashed);
new Thread(()->{serverTCP.start(serverCrashed);}).start();
System.out.println("Server RMI: "+System.getProperty("java.rmi.server.hostname"));
}
@@ -79,6 +79,7 @@ public class LoginFXMLController {
labelErrore.setText("Compila tutti i campi.");
return;
}
System.setProperty("java.rmi.server.hostname", ip);
int networkType = btnRMI.isSelected() ? 0 : 1;
String interfaccia = getInterfaccia();