From 3354802a1370753aa5314aa10196a01724414e88 Mon Sep 17 00:00:00 2001 From: Fedi6431 <102946457+Fedi6431@users.noreply.github.com> Date: Sun, 14 Jul 2024 11:06:47 +0200 Subject: [PATCH] Update ClientGUI.java --- src/ClientGUI.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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()));