Fix: ClientLauncher local IP select
This commit is contained in:
@@ -30,6 +30,7 @@ public class RMIClient implements IClient {
|
||||
/** Client game's controller */
|
||||
ClientController controller;
|
||||
|
||||
private String myIP;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
@@ -37,10 +38,11 @@ public class RMIClient implements IClient {
|
||||
* @param host the host address of the RMI server
|
||||
* @param port the port of the RMI server
|
||||
*/
|
||||
public RMIClient(ClientController controller, String host, int port) {
|
||||
public RMIClient(ClientController controller, String host, int port, String myIP) {
|
||||
this.controller=controller;
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
this.myIP = myIP;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,8 +56,7 @@ public class RMIClient implements IClient {
|
||||
*/
|
||||
public boolean connect(String username,int preferredInt) {
|
||||
try {
|
||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||
System.setProperty("java.rmi.server.hostname", ip);
|
||||
System.setProperty("java.rmi.server.hostname", this.myIP);
|
||||
Registry registry = LocateRegistry.getRegistry(host, port);
|
||||
this.stub = (IGameServer) registry.lookup("RMIGameServer");
|
||||
ClientCallbackImpl callback = new ClientCallbackImpl(controller);
|
||||
|
||||
Reference in New Issue
Block a user