Runtime Library
・
Overview
Diarkis Runtime Library contains the core low-level features of the runtime.
Main Features
Core Functions
Diarkis TCP/UDP/RUDP communication
Thread management
Memory management and custom allocator
NAT type detection
Functionality of each module
Diarkis TCP/UDP/RUDP Communication
The Diarkis Runtime Library supports communication via TCP/UDP/RUDP.
Thread Management
The Diarkis Runtime Library provides Diarkis::DiarkisThread
to perform thread operations across multiple platforms.
Using Diarkis::DiarkisThread
allows you to operate threads with the same interface on all supported platforms.
Memory Management and Custom Allocator
In the Diarkis Runtime Library, users can replace internal memory allocation/deallocation 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.
Functionality of Each Module
For more information on the functionality of each module, we recommend using Diarkis Module. If you want to use the functions of each module 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
Sockets are created per UDP server connection / TCP server connection.
UDP:
Sockets are created by the runtime library when
DiarkisUdp::Connect(Async)
orDiarkisUdp::ConnectDualMode(Async)
is called.For P2P, sockets created with UDP are used.
TCP:
Sockets are created by the runtime library when
DiarkisTcp::Connect
orDiarkisTcp::ConnectDualMode
is called.
If there are multiple connecting Diarkis servers, you need to create multiple instances of
DiarkisInterfaceBase
, increasing the number of sockets proportionally to the number of instances.
Memory
(Coming Soon)
Threads
One thread is created for TCP connection, and two threads are created for UDP connection.
When using the Diarkis client, threads are also created on the Diarkis Module side. For details, refer to Diarkis Threads.
Notes
The Diarkis Module API is not thread-safe. If using Diarkis Module in multiple threads, implement exclusive control at the application level.
最終更新