Skip to content

Commit 2437d36

Browse files
committed
docs: 📝 network communication
1 parent fd57310 commit 2437d36

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,17 @@ byte_limit = 512
143143
bytes_per_tick = 6
144144
```
145145

146+
147+
## Network Communication
148+
149+
The network layer of the chat application consists of the protocol and the socket. It is responsible for managing the communication between the clients and the server.
150+
151+
The protocol, defined in `proto.rs`, contains two main structures: `Sndr` and `Rcvr`. These structures represent messages exchanged between the server and clients. The `Sndr` enum is used for sending messages, while the `Rcvr` enum is used for receiving messages. Some messages are bi-directional, meaning they can be used in both directions, while others are specific to client-to-server or server-to-client communication.
152+
153+
The `Socket` struct, defined in `socket.rs`, handles the underlying TCP stream and provides methods to read data, write data, and handle incoming messages. The `SocketError` struct represents errors that may occur during socket operations. The `Socket` struct also offers methods to manage the read and write buffers, set buffer sizes, send data in a blocking or non-blocking manner, and manage the connection's state.
154+
155+
Together, the `Socket` and `proto` modules form the network layer of the chat application, providing a robust and efficient way to exchange messages between clients and the server.
156+
146157
### TODO (server):
147158

148159
- IP specific blocks/bans. Server doesn't really know anything about the

0 commit comments

Comments
 (0)