Skip to content

TCP chat server and CLI client in Rust#38

Open
cy00r wants to merge 7 commits intowhamcloud:mainfrom
cy00r:main
Open

TCP chat server and CLI client in Rust#38
cy00r wants to merge 7 commits intowhamcloud:mainfrom
cy00r:main

Conversation

@cy00r
Copy link
Copy Markdown

@cy00r cy00r commented Apr 2, 2026

Demo

demo-new.mp4

Overview

Async TCP chat server and CLI client built with Tokio. Single chat room where users can join, send messages, and leave.

Features

  • Non-blocking async server using Tokio broadcast channel
  • Unique username enforcement
  • Messages broadcast to all users except the sender
  • Graceful cleanup on leave or abrupt disconnect
  • CLI client accepts config via env vars or CLI args

Usage

# Start server
cargo run -p server

# Connect as a user
cargo run -p client -- 127.0.0.1 8080 alice

Commands

  • send <MSG> — broadcast a message
  • leave — disconnect and exit

Testing

cargo test --all   # 14 tests (8 client + 6 server)

Bonus

  • ✅ Pre-commit hook — git config core.hooksPath .githooks
  • ✅ GitHub Actions CI — runs on every push to any branch
  • ✅ E2E smoke test — starts server, connects client, sends message, verifies exit code 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant