Getting Started
To use cpp-udpnet, include the cppudpnet.hpp header in your project. It also depends on cpp-pubsub and cpp-asyncworker.
Integration
1. CMake: FetchContent (Recommended)
You can have CMake automatically download and integrate cpp-udpnet and its dependencies.
include(FetchContent)
FetchContent_Declare(
cppudpnet
GIT_REPOSITORY https://github.com/jonoton/cpp-udpnet.git
GIT_TAG main
)
FetchContent_MakeAvailable(cppudpnet)
target_link_libraries(your_target PRIVATE cppudpnet::cppudpnet)
2. Manual Include
Since cpp-udpnet is a header-only library, you can simply copy cppudpnet.hpp into your project. You will also need to include cpppubsub.hpp and cppasyncworker.hpp from their respective repositories.
Prerequisites
- C++17 or later
- CMake 3.10+ (for CMake-based integration)
- Platform: Windows, Linux, or macOS
Platform-Specific Notes
- Windows: The library automatically links against
ws2_32.liband initializes Winsock2. - Linux/macOS: Standard POSIX socket APIs are used. No additional libraries are required.
Dependencies
| Dependency | Purpose |
|---|---|
| cpp-pubsub | Event-driven publish/subscribe messaging |
| cpp-asyncworker | Thread pool and asynchronous worker management |
Both dependencies are automatically fetched by CMake’s FetchContent when using the recommended integration method.
| 🏠 Home | Next: Basic Usage > |