Wired is a modern, open-source C++ networking library designed to simplify the development of cross-platform networked applications. It provides a clear and minimal API, supports asynchronous operations via Asio, and enables secure communication through OpenSSL.
Clone the repository and initialize submodules:
git clone --recursive https://github.com/Robertkq/Wired.gitIf you already cloned the repository without --recursive, run:
git submodule update --init --recursiveWired uses CMake for building and installation.
-
Create a build directory:
mkdir build cd build -
Configure the project:
cmake ..
-
Build and install the library (requires admin privileges):
sudo cmake --install .
Once installed, you can use Wired in your own CMake project:
find_package(Wired REQUIRED)
find_package(OpenSSL REQUIRED)
add_executable(my_project main.cpp)
target_include_directories(my_project PRIVATE ${Wired_INCLUDE_DIRS})
target_link_libraries(my_project PRIVATE OpenSSL::SSL OpenSSL::Crypto)Wired includes unit tests, static analysis, and code coverage tools.
cd tests/unit
mkdir build
cd build
cmake ..
cmake --build . -j
./unitMake sure cppcheck is installed, then run:
cd tests/static_analyzer
mkdir build
cd build
cmake ..
cmake --build .- Run the unit tests as described above.
- Ensure
lcovis installed. - Generate coverage data:
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '*13*' '*openssl*' '*/gtest/*' '*/asio/*' --output-file coverage_filtered.info
lcov --summary coverage_filtered.info- Generate HTML report:
genhtml coverage_filtered.info --output-directory coverage_reportThe examples/ directory contains demonstration applications built with Wired. These can be compiled and run on both Linux and Windows.
Basic client-server communication.
cd examples/simple_application
mkdir build
cd build
cmake ..
cmake --build . -j
./server # in one terminal
./client # in another terminalThe client sends three messages ("ping") to the server, then disconnects.
A basic multi-client chat server.
cd examples/chat
mkdir build
cd build
cmake ..
cmake --build . -j
./server
./client # run in multiple terminalsEach client chooses a username. Messages are broadcast to all connected clients. Type exit to disconnect.
A two-player networked tic-tac-toe game.
cd examples/tic-tac-toe
mkdir build
cd build
cmake ..
cmake --build . -j
./server
./clientClients can type play to join the matchmaking queue. When two clients are queued, a game begins. Type exit to disconnect.
- Commands are compatible with both Linux and Windows (PowerShell with compatible tooling).
- On Windows, executables will have
.exeextensions. - On Linux, make executables runnable if needed:
chmod +x ./server chmod +x ./client
- Logging is enabled by default. For unit tests, pass
--helpfor options. For example applications, logging can be configured in eachmain.cpp.