diff --git a/src/main/java/ChatServer.java b/src/main/java/ChatServer.java index 92a4497..b118b63 100644 --- a/src/main/java/ChatServer.java +++ b/src/main/java/ChatServer.java @@ -7,10 +7,10 @@ import java.util.concurrent.CopyOnWriteArrayList; public class ChatServer { private ServerSocket serverSocket; - private List clients; + private List clients; // Liste, um alle verbundenen Clients zu verwalten public ChatServer(int port) { - clients = new CopyOnWriteArrayList<>(); + clients = new CopyOnWriteArrayList<>(); // Verwende CopyOnWriteArrayList für die Thread-Sicherheit try { serverSocket = new ServerSocket(port); @@ -18,9 +18,9 @@ public class ChatServer { while (true) { System.out.println("waiting for new Client..."); - Socket connectionToClient = serverSocket.accept(); + Socket connectionToClient = serverSocket.accept(); // Auf Verbindungen von Clients warten ClientHandler client = new ClientHandler(this, connectionToClient); - clients.add(client); + clients.add(client); // Neuen Client zur Liste hinzufügen System.out.println("Accepted new Client"); } } catch (IOException e) {