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() {