Both TCP and RMI works and receive correctly the model.

After receiving the model, it is printed in stdout
This commit is contained in:
2026-04-30 18:10:11 +02:00
parent 7e3623d3ae
commit d66af3a112
2 changed files with 8 additions and 23 deletions
@@ -24,7 +24,7 @@ public class ClientLauncherTUI {
System.out.println("Selezionare RMI[0] o TCP[1]: ");
int networkType = scanner.nextInt();
scanner.close();
if (networkType == 0) {
RMIClient client = new RMIClient(controller, "localhost", 1099);
@@ -36,19 +36,10 @@ public class ClientLauncherTUI {
}
while(true) {
System.out.flush();
if (controller.localController.getModel()!=null) {
break;
}
Thread.sleep(500);
int h = scanner.nextInt();
}
System.out.println("Model set\n\n");
System.out.print("\033[H\033[2J");
System.out.flush();
System.out.println(controller.localController.getModel());
} else if (networkType == 1) {
TCPClient client = new TCPClient(controller, "localhost", 8080);
@@ -58,19 +49,12 @@ public class ClientLauncherTUI {
System.out.println("TCP connection refused\n\n");
}
while(true) {
System.out.flush();
if (controller.localController.getModel()!=null) {
break;
}
Thread.sleep(500);
int h = scanner.nextInt();
}
System.out.println("Model set\n\n");
System.out.print("\033[H\033[2J");
System.out.flush();
System.out.println(controller.localController.getModel());
}
scanner.close();
}
}