This project demonstrates a Client-Server network communication system using WebSockets in Qt C++. It showcases real-time communication between multiple clients and a central server through a GUI-based interface.
The goal of this project is to simulate a real-time chat system using WebSocket technology in the Qt framework. It consists of two exercises:
- Exercise 2: Simple client-server communication
- Exercise 3: Multiple clients communicating with a centralized server
- Bi-directional communication using WebSockets
- GUI for both server and clients
- Broadcast messages to all connected clients
- Proper connection handling and message dispatching
- Real-time data exchange
- RTT (Round Trip Time) and throughput measurement
- Encrypted message transmission and integrity verification
The server listens for incoming WebSocket connections and relays messages from one client to all others in real time.
Each client is assigned a unique socket descriptor that defines the open channel between the server and the client.
The server uses a hash table where the client's assigned name (e.g., Client_1) is the key, and the corresponding socket descriptor is the value used for communication.

The server listens on port 1234. When a client connects, it is assigned a name and a socket descriptor to keep the channel open for communication.

The client receives a welcome message along with its assigned name. It also displays metrics such as RTT and throughput, using a timestamp to measure the round-trip time from sending a request to receiving a response.

The server receives encrypted messages from the client, decrypts them, and uses a hash to verify data integrity.

When the client presses the Disconnect button, the connection is terminated.

The server is notified when a client disconnects.
To build and run the project, you need to have Qt installed.
➡️ Download Qt
Make sure to install:
- Qt 6.5+ (or compatible)
- Desktop development tools
- A suitable compiler (e.g., MinGW or MSVC)
During installation, configure the Qt version according to your system and ensure Qt Creator is included.
- Clone the repository:
git clone https://github.com/Mohamed-Magdy-Dewidar/Qt-WebSocket-Client-Server-Network-Communication-System.git cd Qt-WebSocket-Client-Server-Network-Communication-System
Open in Qt Creator:
Navigate to ex_2 folder (Client App)
Open the .pro file with Qt Creator and build it
Navigate to ex_3 folder (Server App)
Open the .pro file with Qt Creator and build it
Run the server first, then connect one or more clients.
🛠️ Tools & Technologies Qt 6.8+ (Qt Widgets & WebSockets)
C++17
Qt Signal-Slot Mechanism
Git for version control
📬 Contact For inquiries or contributions, feel free to reach out via GitHub issues or fork the repo.
