A multi-threaded Client-Server application written in C++ using the Qt 6 framework. This system allows clients to connect to a remote server to perform file system operations (create, read, write, delete) using a custom JSON-based command protocol.
- Qt 6 Architecture: Built and optimized for the latest Qt 6 ecosystem.
- TCP Communication: Persistent socket connection between multiple clients and a central server.
- JSON Protocol: All data exchange uses JSON for structured command and response handling.
- Authentication: Basic username/password protection for sensitive file operations.
- Multi-threading:
- Server: Handles each client connection asynchronously.
- Client: Uses a dedicated worker thread for non-blocking console input.
- Unit Testing: Integrated Google Test (GTest) suite for parsers, commands, and factories.
The client communicates with the server using the following text commands. Arguments are separated by spaces or semicolons.
| Command | Syntax | Description | Auth Required |
|---|---|---|---|
| AUTH | AUTH <user>;<pass> |
Authenticate with the server. | No |
| CREATE | CREATE <filename> |
Create a new empty file. | Yes |
| WRITE | WRITE <filename>;<text> |
Overwrite a file with new content. | Yes |
| APPEND | APPEND <filename>;<text> |
Append text to the end of a file. | Yes |
| READ | READ <filename> |
Read and display file contents. | Yes |
| DELETE | DELETE <filename> |
Delete a file permanently. | Yes |
| RENAME | RENAME <old>;<new> |
Rename a file. | Yes |
| INFO | INFO <filename> |
Get file size and modification date. | Yes |
| LIST | LIST |
List all files in the server directory. | Yes |
- C++ Compiler: GCC, Clang, or MSVC supporting C++17.
- Qt Framework: Qt 6 (Core, Network, Concurrent modules).
- Google Test: Required for building the Test suite (
libgtest-dev).
This project uses QMake (or qmake6).
-
Navigate to the project root:
cd /path/to/ProjectRoot -
Generate Makefiles:
/path/to/qmake6 -r
-
Build All Modules:
make
Binaries will be generated in the
build/bin/directory.
Important: All commands should be executed from the Workspace directory to ensure file paths and logs are managed correctly.
The server must be started first.
cd Workspace
../build/bin/ServerOpen a new terminal, navigate to Workspace, and run the client.
cd Workspace
../build/bin/ClientOnce connected, type commands directly into the console:
AUTH admin;admin
CREATE test.txt
WRITE test.txt;Hello World
READ test.txt
Run the Google Test suite to verify logic.
cd Workspace
../build/bin/TestsRoot/
├── Client
│ ├── Client.cpp
│ ├── Client.h
│ ├── Client.pro
│ ├── InputWorker.h
│ ├── Makefile
│ └── main.cpp
├── Common.h
├── Makefile
├── Project.pro
├── README.md
├── Server
│ ├── ClientContext.cpp
│ ├── ClientContext.h
│ ├── Command.cpp
│ ├── Command.h
│ ├── Factory.cpp
│ ├── Factory.h
│ ├── ICommand.h
│ ├── Makefile
│ ├── Parser.cpp
│ ├── Parser.h
│ ├── Server.cpp
│ ├── Server.h
│ ├── Server.pro
│ └── main.cpp
├── Tests
│ ├── Command_Test.cpp
│ ├── Makefile
│ ├── Parser_Test.cpp
│ ├── Tests.pro
│ └── main.cpp
├── Workspace
│ ├── file
│ └── m.txt
├── build
│ └── bin
│ ├── Client
│ ├── Server
│ └── Tests
└── defaults.pri
This project is open-source software.