Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chat Server

A multi-client TCP broadcast chat server built with Tokio — because writing a chat server is the best way to actually understand async Rust in practice.

Every client that connects gets its own task. Messages broadcast to everyone. Ctrl+C shuts everything down cleanly — no dropped connections, no panics, no zombie tasks.

What it does

  • Multiple clients connect over TCP simultaneously
  • Every message broadcasts to all connected clients
  • Graceful shutdown via Ctrl+C using CancellationToken
  • Each client handled in its own Tokio task

Run it

cargo run

# connect from another machine on the same network
nc <your-local-ip> <port>

What it covers

  • tokio::net::TcpListener and TcpStream
  • broadcast channel for fan-out messaging
  • CancellationToken for coordinated shutdown
  • Concurrent task management with JoinSet

About

Multi-client TCP broadcast chat server with graceful shutdown using Tokio and CancellationToken.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages