Update Sudoku networking
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
# Protocol overview
|
# Protocol overview
|
||||||
|
|
||||||
- The Client first tries to log in with his pseudo (**LoginPacket**)
|
- 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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
||||||
Reference in New Issue
Block a user