Skip to content

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.

void Engine::Network::UdpClient::Disconnect () 


function GetPing

uint32_t Engine::Network::UdpClient::GetPing () noexcept const

function GetState

inline ConnectionState Engine::Network::UdpClient::GetState () noexcept const

function IsConnected

inline bool Engine::Network::UdpClient::IsConnected () noexcept const

function PollEvents

Polls incoming network packets from the server.

void Engine::Network::UdpClient::PollEvents (
    const std::function< void(const NetworkEvent &)> & handler
) 

Parameters:

  • handler Callback 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 [½]

Engine::Network::UdpClient::UdpClient () 

function UdpClient [2/2]

Engine::Network::UdpClient::UdpClient (
    const UdpClient &
) = delete

function operator=

UdpClient & Engine::Network::UdpClient::operator= (
    const UdpClient &
) = delete

function ~UdpClient

virtual Engine::Network::UdpClient::~UdpClient () 


The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Network/UdpClient.hpp