diff --git a/src/client/Client.java b/src/client/Client.java index a9ca1b3b1ec660e097ede6d0cebefa7401f7738b..acfe956e63539b52110b1831e0570e2d2a1f87c5 100644 --- a/src/client/Client.java +++ b/src/client/Client.java @@ -93,9 +93,9 @@ public class Client } - public Client(String username) throws RemoteException, NoSuchProviderException, NoSuchAlgorithmException + public Client() throws RemoteException, NoSuchProviderException, NoSuchAlgorithmException { - this.defaultUserName = username; + this.defaultUserName = DEFAULT_USERNAME; this.clientUpdate = new ClientUpdate(this); this.chatUpdate = new ChatUpdate(this); this.drawingUpdate = new DrawingUpdate(this); @@ -108,7 +108,7 @@ public class Client { try { - Client client = new Client(args[0]); + Client client = new Client(); client.showStartScreen(); } catch (Exception e) diff --git a/src/server/Server.java b/src/server/Server.java index 9e0084d77316ae0cdabc05dc2755b48cf327bef0..b65b320e1acd0861b99fa9eeb41d0cb345a9c8cc 100644 --- a/src/server/Server.java +++ b/src/server/Server.java @@ -50,7 +50,7 @@ public class Server { Server server = new Server(); - server.run(); + server.run(args[0]); } catch( Exception e ) { @@ -58,15 +58,15 @@ public class Server } } - public void run() throws RemoteException + public void run(String serverIP) throws RemoteException { - String serverIP = ""; - try { - InetAddress inetAddress = InetAddress.getLocalHost(); - serverIP = inetAddress.getHostAddress(); - } catch (Exception e) { - e.printStackTrace(); - } +// String serverIP = ""; +// try { +// InetAddress inetAddress = InetAddress.getLocalHost(); +// serverIP = inetAddress.getHostAddress(); +// } catch (Exception e) { +// e.printStackTrace(); +// } System.setProperty("java.rmi.server.hostname", serverIP); @@ -91,16 +91,18 @@ public class Server System.out.println("Server is ready"); - printIP(); + printIP(serverIP); } - private void printIP() + private void printIP(String serverIP) { InetAddress inetAddress = null; try { - inetAddress = InetAddress.getLocalHost(); + if (serverIP.isEmpty()) { + inetAddress = InetAddress.getLocalHost(); + } else inetAddress = InetAddress.getByName(serverIP); } catch (UnknownHostException e) {