Cross-platform TLS chat app built with Boost.Asio (C++20).
This project provides:
chat_server: async TLS chat serverchat_client: console TLS client with auto-reconnect- Length-prefixed JSON protocol (
4-byte big-endian length + JSON payload) - Optional Python stress test for load testing
- TLS-encrypted client/server communication
- Broadcast chat messages
- Private/direct messages
- Join/leave notifications
- Multi-threaded server
io_contextexecution - Automatic client reconnect on disconnect
server/– server implementationclient/– console client and networkingcommon/– shared protocol and TCP framing utilitiescerts/– TLS cert and key (server.crt,server.key)scripts/stress_test.py– asyncio-based stress/load tool
- CMake
>= 3.16 - C++20 compiler (
g++/clang++) - Boost (System)
- OpenSSL
- POSIX Threads
- nlohmann/json headers
Typical Ubuntu packages:
sudo apt-get update
sudo apt-get install -y build-essential cmake libboost-system-dev libssl-dev nlohmann-json3-devFrom repository root:
cmake -S . -B build
cmake --build build -jThis produces:
build/chat_serverbuild/chat_client
Open two terminals.
cd build
./chat_servercd build
./chat_client <username>If username is omitted, it defaults to Test-Client.
The console client expects each line in this format:
<type>|<from>|<to>|<text>
Where <type> is one of:
JoinChatPrivateLeave
Examples:
Chat|alice||Hello everyone!
Private|alice|bob|Hi Bob
Leave|alice||
Note: The client sends
Joinautomatically right after TLS handshake, so manualJoinis usually unnecessary.
- TLS certificate/key paths are currently expected relative to running binaries from
build/. - CMake also copies
certs/intobuild/certs, but runtime code currently loads from../certs/....