I'll create a README for your Chat Room project. Let me first check the CMakeLists.txt to understand the build configuration better.
A C++ chat room application built with Boost.Asio library, demonstrating CMake usage, multi-file linking, and Boost library integration.
This project was created to learn and practice:
- CMake build system configuration
- Linking multiple C++ source files
- Boost library setup and linking
- Asynchronous network programming with Boost.Asio
The ChatRoom application implements a client-server architecture where multiple clients can connect to a central chat server and exchange messages in real-time. The server handles multiple concurrent connections using asynchronous I/O operations.
- Language: C++17
- Networking Library: Boost.Asio 1.90.0
- Build System: CMake 3.16+
- Platform: Windows (with Winsock2 support)
ChatRoom/
├── CMakeLists.txt # CMake build configuration
├── chatRoom.hpp # Chat room server header
├── chatRoom.cpp # Chat room server implementation
├── client.cpp # Client application
├── message.hpp # Message handling utilities
└── .gitignore # Git ignore file
- C++ Compiler with C++17 support
- Boost.Asio Library (version 1.90.0 or similar)
- CMake (version 3.16 or higher)
- Windows Platform (project configured for Windows networking)
-
Install Boost.Asio:
- Download and extract Boost (e.g., to
C:/Users/hp/Downloads/boost_1_90_0/boost_1_90_0) - Update the
BOOST_ROOTpath inCMakeLists.txtif necessary
- Download and extract Boost (e.g., to
-
Build the project:
mkdir build cd build cmake .. cmake --build .
-
Run the applications:
# Start the server (in one terminal) ./server.exe <port> # Start clients (in separate terminals) ./client.exe <port>
-
Start the server by running
server.exewith a port number:server.exe 8080 -
Connect clients by running
client.exewith the same port:client.exe 8080 -
Type messages in the client terminal and press Enter to send
-
Messages will be broadcast to all connected clients
- Handles message serialization with fixed header (4 bytes) and variable body
- Maximum message size: 512 bytes
- Provides encoding/decoding utilities
Participantinterface for chat participantsRoomclass manages connected participants and message broadcastingSessionclass handles individual client connections- Supports up to 100 concurrent participants
- Connects to the chat server
- Handles asynchronous message sending and receiving
- Simple command-line interface for user interaction
The CMakeLists.txt demonstrates:
- Setting C++17 standard
- Configuring Boost library paths
- Creating separate executables for server and client
- Linking Windows networking libraries (
ws2_32,mswsock) - Private include directory configuration
- Asynchronous I/O: Uses Boost.Asio for non-blocking operations
- TCP Protocol: Reliable message delivery
- Message Format: Header-based message framing
- Concurrency: Multiple clients handled simultaneously
This project successfully demonstrates:
- CMake project configuration for multi-file C++ projects
- External library (Boost) integration and linking
- Header-only library usage
- Platform-specific library linking (Windows networking)
- Asynchronous programming patterns
- Object-oriented design in network applications
- Windows-specific networking configuration
- Basic message format without encryption
- No user authentication
- Simple command-line interface
- Cross-platform compatibility (Linux/macOS)
- User authentication system
- Message encryption
- File sharing capabilities
- Private messaging between clients