Minetest  5.4.0
UDPSocket Class Reference

#include <socket.h>

Public Member Functions

 UDPSocket ()=default
 
 UDPSocket (bool ipv6)
 
 ~UDPSocket ()
 
void Bind (Address addr)
 
bool init (bool ipv6, bool noExceptions=false)
 
void Send (const Address &destination, const void *data, int size)
 
int Receive (Address &sender, void *data, int size)
 
int GetHandle ()
 
void setTimeoutMs (int timeout_ms)
 
bool WaitData (int timeout_ms)
 

Private Attributes

int m_handle
 
int m_timeout_ms
 
int m_addr_family
 

Constructor & Destructor Documentation

◆ UDPSocket() [1/2]

UDPSocket::UDPSocket ( )
default

◆ UDPSocket() [2/2]

UDPSocket::UDPSocket ( bool  ipv6)

References init().

+ Here is the call graph for this function:

◆ ~UDPSocket()

UDPSocket::~UDPSocket ( )

Member Function Documentation

◆ Bind()

void UDPSocket::Bind ( Address  addr)

References dstream, errorstream, Address::getAddress(), Address::getAddress6(), Address::getFamily(), Address::getPort(), m_addr_family, m_handle, Address::serializeString(), and socket_enable_debug_output.

Referenced by con::ConnectionSendThread::connect(), con::ConnectionSendThread::serve(), TestSocket::testIPv4Socket(), and TestSocket::testIPv6Socket().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetHandle()

int UDPSocket::GetHandle ( )

References m_handle.

Referenced by con::Connection::getDesc().

+ Here is the caller graph for this function:

◆ init()

bool UDPSocket::init ( bool  ipv6,
bool  noExceptions = false 
)

References dstream, g_sockets_initialized, itos(), LAST_SOCKET_ERR, m_addr_family, m_handle, setTimeoutMs(), and socket_enable_debug_output.

Referenced by UDPSocket(), and TestSocket::testIPv6Socket().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Receive()

int UDPSocket::Receive ( Address sender,
void *  data,
int  size 
)

References IPv6AddressBytes::bytes, dstream, m_addr_family, m_handle, m_timeout_ms, Address::print(), socket_enable_debug_output, and WaitData().

Referenced by con::ConnectionReceiveThread::receive(), TestSocket::testIPv4Socket(), and TestSocket::testIPv6Socket().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Send()

void UDPSocket::Send ( const Address destination,
const void *  data,
int  size 
)

References dstream, Address::getAddress(), Address::getAddress6(), Address::getFamily(), Address::getPort(), INTERNET_SIMULATOR, INTERNET_SIMULATOR_PACKET_LOSS, m_addr_family, m_handle, myrand(), Address::print(), and socket_enable_debug_output.

Referenced by con::ConnectionSendThread::rawSend(), TestSocket::testIPv4Socket(), and TestSocket::testIPv6Socket().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTimeoutMs()

void UDPSocket::setTimeoutMs ( int  timeout_ms)

References m_timeout_ms.

Referenced by con::Connection::Connection(), and init().

+ Here is the caller graph for this function:

◆ WaitData()

bool UDPSocket::WaitData ( int  timeout_ms)

References dstream, infostream, and m_handle.

Referenced by Receive().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_addr_family

int UDPSocket::m_addr_family
private

Referenced by Bind(), init(), Receive(), and Send().

◆ m_handle

int UDPSocket::m_handle
private

◆ m_timeout_ms

int UDPSocket::m_timeout_ms
private

Referenced by Receive(), and setTimeoutMs().


The documentation for this class was generated from the following files: