SimpleChatBox is a high-performance, enterprise-grade real-time chat and multimedia communication platform built on C# Windows Forms and .NET Framework 4.8. It operates with zero external NuGet package dependencies, relying solely on native .NET Base Class Libraries (BCL).
The platform showcases robust software engineering patterns: length-prefixed TCP binary framing, ECDH shared secret negotiation, AES-256-CBC end-to-end encryption, STUN NAT traversal with UDP hole punching, server relay fallback, pluggable synthetic camera video capture, desktop screen sharing, a live telemetry server dashboard, and an automated regression test suite.
| Real-Time Chat & Direct Messaging | P2P Video Call & Synthetic Camera HUD |
|---|---|
![]() |
![]() |
| Server Management & Telemetry Console | 1-Click Demo Authentication |
|---|---|
![]() |
![]() |
- Zero Webcam Hardware Required: Features an embedded high-performance Synthetic Camera (
SyntheticVideoSource) that generates animated radar sweeps, live millisecond clocks, dynamic audio frequency bars, and user identity badges at 15β20 FPS. - Desktop Screen Sharing: Includes
ScreenCaptureVideoSourceto capture and stream the active desktop display in real-time. - Picture-in-Picture (PIP) & Camera Switch: Local preview window rendered simultaneously over remote incoming streams with memory-safe GDI bitmap recycling.
- STUN NAT Traversal (RFC 5389): Discovers public IP endpoints and initiates UDP hole punching for direct peer-to-peer streaming.
- Automatic Server Relay Fallback: Seamlessly falls back to TCP server relay when UDP hole punching is blocked by symmetric NATs or restrictive firewalls.
- ECDH Key Exchange: Implements Diffie-Hellman Elliptic Curve Key Exchange (
DiffieHellmanHelper) for per-session shared secret negotiation. - AES-256-CBC Encryption: End-to-end encrypted messaging with dynamically generated initialization vectors (IVs).
- Secure Authentication: SHA-256 hashed password storage (
UserStore) with pre-seeded demo credentials.
- Live Client Directory:
ListViewdisplaying client IDs, usernames, display names, IP endpoints, connection timestamps, and packet counters. - Administrative Controls: Right-click context menu to disconnect/kick connected clients.
- Real-Time HUD: Live uptime clock, total routed message counters, and host IP address display for LAN discovery.
- One-Click Multi-Client Launch: Dedicated button to automatically spin up 2 demo client instances (
aliceandbob).
- 1-Click Demo Login: Quick-access buttons for pre-seeded users (
π€ Alice,π€ Bob,π€ Charlie). - CLI Automation: Supports command-line auto-login arguments (e.g.,
ChatBox.Client.exe demo_alice). - File Transfer Progress: Real-time chunk transmission progress (
cur/total chunksand percentage indicator). - Dedicated Image Previewer: Modal dialog (
frmImagePreview) for viewing received.jpg,.png,.gif, and.bmpfiles with image dimensions, file size, and explorer shortcuts. - Tabbed Chat Interface: Dynamic tabs for the public general room and private 1-on-1 conversations with unread indicators.
- Custom lightweight test runner with zero third-party dependencies verifying:
- Packet serialization, length-prefixed framing, and UTF-8 encoding.
- AES-256 encryption/decryption roundtrips and ECDH shared key equivalence.
- User authentication, password hashing, and message history persistence.
- Video generator frame capture, synthetic radar animation, and JPEG SOI header validity.
- STUN packet construction and attribute parsing.
- Large file chunking, reassembly, and SHA-256 payload integrity.
- Cryptographic invariants (random IV uniqueness and tamper resistance).
- Floating PIP geometry and boundary clipping.
ChatBoxSimple.sln
β
βββ ChatBox.Shared/ # Core BCL Library (Shared across Server & Client)
β βββ Constants/AppConstants.cs # Protocol ports, buffer limits, chunk sizes
β βββ Crypto/ # AES-256-CBC & Diffie-Hellman (ECDH) helpers
β βββ DTOs/ # Network data transfer contracts
β βββ Network/StunClient.cs # RFC 5389 STUN NAT traversal engine
β βββ Protocol/ # Packet framing, packet types, and JSON serialization
β
βββ ChatBox.Server/ # WinForms Server Management Host
β βββ Data/ # UserStore (JSON) & MessageStore (JSON history)
β βββ Models/ # ConnectedClient & UserAccount
β βββ Services/ # TcpServerService, AuthService, MessageRouter
β βββ Forms/frmServer.cs # Telemetry HUD, Client list, and 1-click launcher
β
βββ ChatBox.Client/ # WinForms End-User Client
β βββ Forms/ # frmLogin, frmChat, frmVideoCall, frmImagePreview
β βββ Helpers/VideoRecorder.cs # Video call recording hooks
β βββ Services/ # Pluggable IVideoSource, VideoCallService,
β # FileTransferService, FileReceiveService, UdpPeerService
β
βββ ChatBox.Tests/ # Standalone Automated Test Runner (.NET 4.8)
βββ Program.cs # Test harness entry point (exit code 0/1)
βββ ProtocolTests.cs # Serialization and packet integrity tests
βββ CryptoTests.cs # Cryptographic roundtrip & invariant tests
βββ StorageTests.cs # Database and persistence tests
βββ VideoSourceTests.cs # Video frame generation, compression & PIP tests
βββ StunTests.cs # RFC 5389 STUN protocol tests
βββ FileTransferTests.cs # Chunking and reassembly tests
βββ DemoScreenshotGenerator.cs# High-resolution screenshot generator for documentation
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client A Server Client B β
β β β β β
β βββSTUN Discoveryβββββββββ β β
β β (Public IP/Port) β β β
β β β β β
β βββVideoCallRequestββββββββββForward Signalββββ β
β β β βββAcceptβββββββ€ β
β β βββForward Signalβββββ€ β β
β β β β
β βββββββββββββ UDP Hole Punching βββββββββββββββ€ β
β β β β
β β [Success] β Direct P2P UDP Streaming β β
β β [Failure] β Fallback TCP Server Relay β β
β β β β
β βββDisplay Local PIP (Synthetic/Screen Share)ββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
All demo accounts are pre-seeded in UserStore with password 123:
| Username | Password | Display Name | Role |
|---|---|---|---|
alice |
123 |
Alice Johnson | Demo User A |
bob |
123 |
Bob Williams | Demo User B |
charlie |
123 |
Charlie Davis | Demo User C |
- Operating System: Windows 10 / 11 / Windows Server 2016+
- Runtime: .NET Framework 4.8 runtime (pre-installed on modern Windows)
- Build Tools: .NET SDK (
dotnet build) or Visual Studio 2022 / MSBuild
Run the PowerShell orchestrator script from the repository root:
powershell -ExecutionPolicy Bypass -File .\scripts\run-demo.ps1This script automatically:
- Compiles the solution in
Debugconfiguration. - Executes the regression test suite (
ChatBox.Tests.exe). - Starts the Server Dashboard and binds to port
9000. - Spawns two pre-configured demo clients (
AliceandBob) with automatic login.
dotnet build ChatBoxSimple.sln -c Debug.\ChatBox.Tests\bin\Debug\ChatBox.Tests.exe.\ChatBox.Server\bin\Debug\ChatBox.Server.exe- Click βΆ Start to bind port
9000. - Click β‘ Launch 2 Demo Clients to launch both Alice and Bob simultaneously.
.\ChatBox.Client\bin\Debug\ChatBox.Client.exe demo_alice
.\ChatBox.Client\bin\Debug\ChatBox.Client.exe demo_bobAlternatively, launch ChatBox.Client.exe and click π€ Alice or π€ Bob on the login screen for instant 1-click access.
In adherence with enterprise deployment standards, the project supports both distribution modes:
# Full release package (includes binaries, assets, and debug symbols):
powershell -ExecutionPolicy Bypass -File .\scripts\publish-app.ps1 -Mode Full
# Lite release package (optimized standalone binaries, excludes .pdb symbols):
powershell -ExecutionPolicy Bypass -File .\scripts\publish-app.ps1 -Mode LiteGenerated outputs are placed in publish/Full and publish/Lite, along with redistributable zip archives SimpleChatBox-v1.1.0-Full.zip and SimpleChatBox-v1.1.0-Lite.zip.
This project is licensed under the MIT License - see the LICENSE file for details.



