Browse Source

refactoring: Kommentare

remotes/origin/feature/client/make-input-field-buttons-interactive^2
Paul Kattenborn 11 months ago
parent
commit
1ca86de868
  1. 8
      src/main/java/ChatServer.java

8
src/main/java/ChatServer.java

@ -37,22 +37,22 @@ public class ChatServer {
} }
} }
// Methode, um eine Nachricht an alle verbundenen Clients zu senden
public void broadcastMessage(String message) { public void broadcastMessage(String message) {
System.out.println(message); System.out.println(message);
if (message != null) { if (message != null) {
for (ClientHandler client : clients) { for (ClientHandler client : clients) {
client.sendMessage(message);
client.sendMessage(message); // Nachricht an jeden Client senden
} }
} }
} }
public static void main(String[] args) { public static void main(String[] args) {
new ChatServer(3141);
new ChatServer(3141); // ChatServer auf Port 3141 starten (eventuell den Port flexibler noch wählen? falls belegt)
} }
// Methode, um einen Client aus der Liste der verbundenen Clients zu entfernen
public void removeClient(ClientHandler client) { public void removeClient(ClientHandler client) {
clients.remove(client); clients.remove(client);
} }

Loading…
Cancel
Save