|
|
@ -1,6 +1,8 @@ |
|
|
|
import java.io.*; |
|
|
|
import java.net.Socket; |
|
|
|
|
|
|
|
import javax.swing.JOptionPane; |
|
|
|
|
|
|
|
public class ClientHandler implements Runnable { |
|
|
|
private ChatServer chatServer; |
|
|
|
private Socket connectionToClient; |
|
|
@ -12,7 +14,7 @@ public class ClientHandler implements Runnable { |
|
|
|
public ClientHandler(ChatServer chatServer, Socket connectionToClient) { |
|
|
|
this.chatServer = chatServer; |
|
|
|
this.connectionToClient = connectionToClient; |
|
|
|
name = connectionToClient.getInetAddress().getHostAddress(); // Use the client's IP address as their name for simplicity |
|
|
|
name = JOptionPane.showInputDialog("welcher Benutzername?"); |
|
|
|
|
|
|
|
new Thread(this).start();} // Start a new thread for this client handler |
|
|
|
|
|
|
|