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,35 @@
package network.server;
import java.io.IOException;
import java.net.Socket;
import java.util.Random;
import network.Connexion;
import network.packets.ConnexionInfoPacket;
import network.packets.KeepAlivePacket;
public class ServerConnexion extends Connexion{
public ServerConnexion(Socket socket) throws IOException {
super(socket);
System.out.println("Bonjour le client !");
sendKeepAlive();
}
public void sendKeepAlive() throws IOException {
Random r = new Random();
sendPacket(new KeepAlivePacket(r.nextLong()));
}
@Override
public void visit(ConnexionInfoPacket packet) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'visit'");
}
@Override
public void visit(KeepAlivePacket packet) {
System.out.println("Je l'ai reçu !");
}
}