Runtime Library

Overview

The Diarkis Runtime Library includes low-level features that form the core of the runtime.

Main Features

  • Core Features

    • Diarkis TCP/UDP/RUDP Communication

    • Thread Management

    • Memory Management and Custom Allocator

    • NAT Type Detection

  • Module Features

Diarkis TCP/UDP/RUDP Communication

The Diarkis Runtime Library supports communication via TCP/UDP/RUDP.

Thread Management

The Diarkis Runtime Library offers Diarkis::DiarkisThread to perform thread operations across platforms. Using Diarkis::DiarkisThread enables thread manipulation with the same interface on all supported platforms.

Memory Management and Custom Allocator

Within the Diarkis Runtime Library, users can replace the internal memory allocation and release processes by setting a custom allocator. Implement a custom allocator by inheriting from Diarkis::ICustomAllocator, and set it in the runtime using Diarkis::SetCustomAllocator. An implementation sample code can be found in samples/room_broadcast/main.cpp.

NAT Type Detection

The Diarkis Runtime Library provides NAT type detection in collaboration with the Diarkis server.

Module Features

For features of each module, it is recommended to use Diarkis Module. If using module features directly from the runtime library, please refer to the C++ API Documentation.

Resources Used by the Diarkis Runtime Library

The Diarkis Runtime Library internally allocates and uses the following resources.

  • Sockets

    • A socket is created for each UDP server connection/TCP server connection.

    • UDP

      • Created by the runtime library upon invoking DiarkisUdp::Connect(Async) / DiarkisUdp::ConnectDualMode(Async).

      • P2P uses sockets created with UDP.

    • TCP

      • Created by the runtime library upon invoking DiarkisTcp::Connect / DiarkisTcp::ConnectDualMode.

    • If there are multiple Diarkis servers to connect to, multiple instances of DiarkisInterfaceBase need to be created, increasing the number of sockets by the number of instances.

  • Memory

    • (Coming Soon)

  • Threads

    • One thread is created for TCP connections, and two threads for UDP connections.

    • When using the Diarkis client, threads are also created on the Diarkis Module side. For more details, please check Diarkis Threads.

Important Notes

  • The API of Diarkis Module is not thread-safe. When using Diarkis Module with multiple threads, please implement mutual exclusion control on the application side.

Last updated