Skip to content

Commit 3322204

Browse files
committed
updated Server.java and ServerSocketAcceptingThread.java
1 parent f17af19 commit 3322204

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/de/javasocketapi/core/Server.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ public void sendToAllClients(final Packet packet) {
5555
this.serverSocketAcceptingThread.sendToAllClients(packet);
5656
}
5757

58+
public void disconnectClient(final UUID uuid) throws IOException {
59+
//disconnect client
60+
this.serverSocketAcceptingThread.disconnectClient(uuid);
61+
}
62+
5863
public void disconnectAllClients() throws IOException {
5964
//disconnect all clients
6065
this.serverSocketAcceptingThread.disconnectAllClients();

src/de/javasocketapi/core/ServerSocketAcceptingThread.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ public void sendToAllClients(final Packet packet) {
6060
}
6161
}
6262

63+
public void disconnectClient(final UUID uuid) throws IOException {
64+
//disconnect client
65+
for (Client client : this.clients) {
66+
if (!client.getConnectionUUID().get().equals(uuid)) {
67+
continue;
68+
}
69+
client.disconnect();
70+
}
71+
}
72+
6373
public void disconnectAllClients() throws IOException {
6474
//disconnect all clients
6575
for (Client client : this.clients) {

0 commit comments

Comments
 (0)