established connection between Client and Serveur, setting up basic interactions

This commit is contained in:
Clément
2025-02-27 22:04:11 +01:00
parent fed666200c
commit db9b41b190
8 changed files with 160 additions and 21 deletions

View File

@@ -13,6 +13,10 @@ public class Server {
new Thread(this::readMessages).start();
}
public int getPort() {
return this.socket.getLocalPort();
}
private void sendMessage(String message, InetAddress address, int port) throws IOException {
byte[] buffer = message.getBytes();
DatagramPacket packet = new DatagramPacket(buffer, buffer.length, address, port);