From e334c8f1d09a0677c24d6390c3a06d07b0bd2e9f Mon Sep 17 00:00:00 2001 From: Valentin Spiroski Date: Mon, 5 Feb 2024 13:59:03 +0100 Subject: [PATCH] refactoring: ClientHandler constructor comments --- src/main/java/ClientHandler.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/ClientHandler.java b/src/main/java/ClientHandler.java index 7b96316..9f60c96 100644 --- a/src/main/java/ClientHandler.java +++ b/src/main/java/ClientHandler.java @@ -8,12 +8,14 @@ public class ClientHandler implements Runnable { private BufferedReader fromClientReader; private PrintWriter toClientWriter; + // Constructor for ClientHandler public ClientHandler(ChatServer chatServer, Socket connectionToClient) { this.chatServer = chatServer; this.connectionToClient = connectionToClient; - name = connectionToClient.getInetAddress().getHostAddress(); - new Thread(this).start();} - + name = connectionToClient.getInetAddress().getHostAddress(); // Use the client's IP address as their name for simplicity + + new Thread(this).start();} // Start a new thread for this client handler + @Override public void run() {