A modern TCP chat client with GUI built in Rust using the egui framework.
Example: Connection and Chat Interface
- GUI Interface with egui/eframe
- TCP Networking with threaded I/O
- Connection Management
- IP/Port configuration
- Error handling
- Back button for connection reset
- Real-Time Messaging
- Message history with auto-scroll
- Enter-to-send functionality
- Modular Architecture
- Isolated network layer
- State-driven UI components
- Rust 1.72+
- Cargo package manager
- TCP server (for testing:
nc -l 127.0.0.1 8080)
git clone https://github.com/yourusername/rust-chat-app.git
cd rust-chat-app
cargo run --release - Enter server IP (default: 127.0.0.1)
- Enter port (default: 8080)
- Click Connect
- Type messages in bottom input
- Send with Enter or Send button
- History auto-updates
- Click Back to reset connection
- Returns to connection screen
%%{init: {'theme': 'dark'}}%%
flowchart TD
subgraph UI Layer
A[Connect Screen] -->|IP/Port| B[Chat Screen]
B -->|Back Button| A
B --> C[Settings Panel]
end
subgraph App Core
B --> D[State Manager]
D -->|Update| E[Network Handler]
E -->|Threads| F[TCP Stream]
end
subgraph Server
F --> G[Remote Server]
G -->|Response| F
end
style A fill:#4CAF50,stroke:#333
style B fill:#2196F3,stroke:#333
style D fill:#9C27B0,stroke:#333
style E fill:#FF9800,stroke:#333
Key:
- 🟢 Green: Connection interface
- 🔵 Blue: Chat interface
- 🟣 Purple: State controller
- 🟠 Orange: Network module