Browse Source

refactoring: ClientHandler constructor comments

remotes/origin/feature/client/make-input-field-buttons-interactive
Valentin Spiroski 11 months ago
parent
commit
e334c8f1d0
  1. 6
      src/main/java/ClientHandler.java

6
src/main/java/ClientHandler.java

@ -8,11 +8,13 @@ public class ClientHandler implements Runnable {
private BufferedReader fromClientReader; private BufferedReader fromClientReader;
private PrintWriter toClientWriter; private PrintWriter toClientWriter;
// Constructor for ClientHandler
public ClientHandler(ChatServer chatServer, Socket connectionToClient) { public ClientHandler(ChatServer chatServer, Socket connectionToClient) {
this.chatServer = chatServer; this.chatServer = chatServer;
this.connectionToClient = connectionToClient; 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 @Override
public void run() { public void run() {

Loading…
Cancel
Save