This is a simple multi-user chat server written in Rust using the Tokio library. The server listens for incoming connections on localhost port 8080. When a client sends a message, the server broadcasts the message to all connected clients.
- Rust: You need to have Rust installed on your machine. You can download Rust from the official website.
Follow these steps to run the chat server:
-
Start the server: Open a terminal, navigate to the project directory, and run the following command:
cargo run
This command builds and runs the server. The server will start listening for incoming connections on localhost port 8080.
-
Connect a client: Open a new terminal window and run the following command:
nc -v localhost 8080
This command uses the
nc
(netcat) utility to connect to the server. You can open multiple terminal windows and run this command to simulate multiple clients. -
Send messages: After connecting a client, you can type a message into the terminal and press Enter to send it. The server will broadcast the message to all connected clients.