diff --git a/src/main/java/ClientHandler.java b/src/main/java/ClientHandler.java index c59f1ed..5561e3c 100644 --- a/src/main/java/ClientHandler.java +++ b/src/main/java/ClientHandler.java @@ -39,6 +39,20 @@ public class ClientHandler implements Runnable { } } catch (IOException e) { e.printStackTrace(); + } finally { + //chatServer.removeClient(this); + chatServer.broadcastMessage(name + " disconnected."); + + if (fromClientReader != null) { + try { + fromClientReader.close(); + } catch (IOException e){ + e.printStackTrace(); + } + } + if (toClientWriter != null) { + toClientWriter.close(); + } } }