Update Sudoku networking

2025-02-02 22:52:19 +00:00
parent 351d1f3a8c
commit 02557637ee

@@ -1,4 +1,3 @@
# Protocol overview
- The Client first tries to log in with his pseudo (**LoginPacket**)
@@ -105,8 +104,10 @@ The server send one packet every 5s and the client should respond with the same
The connexions are done by Java **Socket**s, so the protocol used is TCP/IP.
A connexion between a client and the server is represented by the abstract **Connexion** class.
This class implements the **PacketVisitor** interface so that it can process the recieved packets.
The server and the clients inherits this class (**ServerConnexion** and **ClientConnexion**) to process the packets based on their needs.
A client keeps one **ClientConnexion** class while the server keeps one **ServerConnexion** per player.
Each **Connexion** class spawns a new Thread for reading. This means that the server owns a thread per player so it might not scale well with a lot of players.
In addition, the server holds another thread to handle new connexions.
When a valid **Packet** is read by the **Connexion** class, it calls the **visitPacket** method on himself to allow different behaviors depending on the packet recieved by subclasses.