Refactor of network stack

This commit is contained in:
2026-06-09 19:23:58 +02:00
parent 73f3d152af
commit 2fb43c385b
18 changed files with 94 additions and 92 deletions
@@ -2,6 +2,7 @@ package it.polimi.ingsw.gc14;
import it.polimi.ingsw.gc14.Controller.ClientController;
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character;
import it.polimi.ingsw.gc14.Model.GamePackage.GameStages;
import it.polimi.ingsw.gc14.Network.NetworkConfig;
import it.polimi.ingsw.gc14.Network.InterfaceResolver;
import it.polimi.ingsw.gc14.Network.NetworkEvent;
import it.polimi.ingsw.gc14.Network.RMI.Client.RMIClient;
@@ -78,7 +79,7 @@ public class ClientLauncherTUI {
throw new RuntimeException(e);
}
System.setProperty("java.rmi.server.hostname", myIP);
RMIClient client = new RMIClient(controller, IP, 1099, myIP);
RMIClient client = new RMIClient(controller, IP, NetworkConfig.RMI_PORT, myIP);
ErrorType serverResponse=client.connect(username, proposedNumPlayers);
if (serverResponse==null) {
System.out.println("Succesfully connected to RMI server\n\n");
@@ -94,7 +95,7 @@ public class ClientLauncherTUI {
// TCP
} else if (networkType == 1) {
// Connect
TCPClient client = new TCPClient(controller, IP, 8080,8081);
TCPClient client = new TCPClient(controller, IP, NetworkConfig.TCP_PORT, NetworkConfig.HEARTBEAT_PORT);
ErrorType serverResponse=client.connect(username, proposedNumPlayers);
if (serverResponse==null) {
System.out.println("Succesfully connected to TCP server\n\n");