network structure
Some checks failed
Linux arm64 / Build (push) Failing after 5m1s

This commit is contained in:
2025-01-23 18:59:11 +01:00
parent b05351bc20
commit 5e99cd92df
21 changed files with 429 additions and 36 deletions

View File

@@ -0,0 +1,28 @@
package network.server;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.ArrayList;
import java.util.List;
public class Server {
final ServerSocket serverSocket;
final List<ServerConnexion> connexions;
private final ServerThread thread;
public Server(short port) throws IOException {
this.serverSocket = new ServerSocket(port);
this.connexions = new ArrayList<>();
this.thread = new ServerThread(this);
this.thread.start();
}
public void stop() {
this.thread.cancel();
for (ServerConnexion connexion : this.connexions) {
connexion.close();
}
}
}