Class Engine::Network::UdpClient¶
ClassList > Engine > Network > UdpClient
High-performance UDP Client built on ENet.
#include <UdpClient.hpp>
Public Functions¶
| Type | Name |
|---|---|
| bool | Connect (const std::string & hostAddress, uint16_t port, size_t channels=2) Initiates asynchronous connection to a remote UDP server. |
| void | Disconnect () Cleanly disconnects from the server and releases host resources. |
| uint32_t | GetPing () noexcept const |
| ConnectionState | GetState () noexcept const |
| bool | IsConnected () noexcept const |
| void | PollEvents (const std::function< void(const NetworkEvent &)> & handler) Polls incoming network packets from the server. |
| void | SendPacket (const uint8_t * data, size_t size, bool reliable=true, uint8_t channel=0) Sends a packet to the connected server peer. |
| void | SendPacket (const ByteWriter & writer, bool reliable=true, uint8_t channel=0) |
| UdpClient () |
|
| UdpClient (const UdpClient &) = delete |
|
| UdpClient & | operator= (const UdpClient &) = delete |
| virtual | ~UdpClient () |
Public Functions Documentation¶
function Connect¶
Initiates asynchronous connection to a remote UDP server.
bool Engine::Network::UdpClient::Connect (
const std::string & hostAddress,
uint16_t port,
size_t channels=2
)
function Disconnect¶
Cleanly disconnects from the server and releases host resources.
function GetPing¶
function GetState¶
function IsConnected¶
function PollEvents¶
Polls incoming network packets from the server.
void Engine::Network::UdpClient::PollEvents (
const std::function< void(const NetworkEvent &)> & handler
)
Parameters:
handlerCallback invoked for connection, receive, and disconnect events.
function SendPacket [½]¶
Sends a packet to the connected server peer.
void Engine::Network::UdpClient::SendPacket (
const uint8_t * data,
size_t size,
bool reliable=true,
uint8_t channel=0
)
function SendPacket [2/2]¶
void Engine::Network::UdpClient::SendPacket (
const ByteWriter & writer,
bool reliable=true,
uint8_t channel=0
)
function UdpClient [½]¶
function UdpClient [2/2]¶
function operator=¶
function ~UdpClient¶
The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Network/UdpClient.hpp