Go to file
Stephen Seo 510156bc58
Publish doxygen documentation to seodisparate.com / doxygen-gen-and-publish (push) Successful in 1s Details
Run UnitTests / build-and-run-tests (push) Successful in 44s Details
Have forgejo action/workflow use "any_archLinux"
2024-01-22 11:12:58 +09:00
.forgejo/workflows Have forgejo action/workflow use "any_archLinux" 2024-01-22 11:12:58 +09:00
.github/workflows Github action: ensure current ref is checked out 2024-01-12 14:31:36 +09:00
src std::atomic doesn't need volatile 2024-01-14 10:31:38 +09:00
.gitignore Update .gitignore 2021-08-30 12:07:27 +09:00
.gitmodules Remove unused TSQueue and RingBuffer 2019-11-06 14:42:35 +09:00
CMakeLists.txt Add UnitTest file for CXX11_shared_spin_lock 2024-01-12 13:55:28 +09:00
Doxyfile Fix doxygen documentation 2020-01-13 19:22:08 +09:00
LICENSE Update LICENSE year 2024-01-11 21:05:21 +09:00
README.md Update README.md 2023-12-19 12:59:10 +09:00



Provides a network connection over UDP, with verification of packet support via libsodium (optional). Implemented in C++ (up to C++11 standard), but is available via a C api, which should facilitate creating bindings for other programming languages if needed.

This library is still a work in progress, so api breaking changes may happen in the future.
This library is usable. Try testing it out using the NetworkTest binary which is built when Debug builds are enabled (the default) with CMake.

$ ./NetworkTest
[-c | -s] - client or server (default server)
-ll <addr> - listen addr
-lp <port> - listen port
-cl <addr> - connection addr (client only)
-clh <hostname> - connection hostname (client only)
-cp <port> - connection port (client only)
-t <tick_count>
-n - do not add payload to packets
-l (silent|error|warning|info|verbose|debug) - log level, default debug
-e - enable receiving events
-ls - enable libsodium
-ck <pubkey_file> - add pubkey to whitelist
-sk <pubkey> <seckey> - start with pub/sec key pair
-p <"fallback" or "strict"> - set auth policy
--hostname <hostname> - dont run test, just lookup hostname

A typical test can be done with the following parameters:


./NetworkTest -s -ll ::1 -lp 9000 -t 50 -e


./NetworkTest -c -ll ::1 -lp 9001 -cl ::1 -cp 9000 -t 40 -e

NetworkTest gracefully shuts down on SIGINT (Ctrl-C).

The source of NetworkTest can be found in src/test/UDPC_NetworkTest.c.


See the gh-pages generated Doxygen documentation here.

Alternatively, see the generated Doxygen documentation on my website.


Release builds

mkdir buildRelease
cd buildRelease
make DESTDIR=install_destination install

Debug builds

mkdir buildDebug
cd buildDebug
cmake -DCMAKE_BUILD_TYPE=Debug ..


The program in src/test/UDPC_NetworkTest.c is used for testing UDPConnection and is also an example of using the library in a C program.

Debug Builds

NetworkTest only builds when CMAKE_BUILD_TYPE is Debug (default).

UnitTest only builds in Debug mode and if GTest (a unit testing framework) is available.



Other Notes

Inspired by a series of blog posts about networking for games.