diff --git a/src/ClientGUI.java b/src/ClientGUI.java index cedbb4a..3d2f796 100644 --- a/src/ClientGUI.java +++ b/src/ClientGUI.java @@ -43,6 +43,8 @@ public void actionPerformed(ActionEvent e) { try { ServerControlPanel(address, port); } catch (IOException ex) { + JOptionPane.showMessageDialog(null, "Unable to connect to server", "Server login panel", JOptionPane.ERROR_MESSAGE); + System.exit(1); throw new RuntimeException(ex); } } @@ -123,13 +125,12 @@ public static void ServerControlPanel(String address, int port) throws IOExcepti // establish a connection with the server Socket socket = new Socket(address, port); + JOptionPane.showMessageDialog(null, "Connected successfully to the server", "Server login panel", JOptionPane.INFORMATION_MESSAGE); // IP of the server and the client String serverIP = socket.getLocalAddress().getHostAddress(); String clientIP = Inet4Address.getLocalHost().getHostAddress(); - JOptionPane.showMessageDialog(null, "Connected successfully to the server", "Server login panel", JOptionPane.INFORMATION_MESSAGE); - // get input from the terminal BufferedReader ServerInfoOutput = new BufferedReader(new InputStreamReader(socket.getInputStream()));