From 6bb126c186cb48ccd46aa8915a7b5700f49d9c3b Mon Sep 17 00:00:00 2001 From: Alena Bandarovich Date: Wed, 7 Feb 2024 19:19:17 +0100 Subject: [PATCH] Close server at the end --- src/main/java/ChatClient.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/ChatClient.java b/src/main/java/ChatClient.java index 2c043b5..ba31d5e 100644 --- a/src/main/java/ChatClient.java +++ b/src/main/java/ChatClient.java @@ -60,6 +60,12 @@ public class ChatClient extends JFrame implements KeyListener { } } catch (IOException e) { JOptionPane.showMessageDialog(null, "Verbindung zum Server \"" + address + "\" fehlgeschlagen."); + } finally { + try { + connectionToServer.close(); + } catch (IOException e) { + e.printStackTrace(); + } } }