|
|
@ -8,11 +8,13 @@ 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() { |
|
|
|