#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 |
|
default |
UDPSocket::UDPSocket | ( | bool | ipv6 | ) |
UDPSocket::~UDPSocket | ( | ) |
References dstream, m_handle, and socket_enable_debug_output.
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().
int UDPSocket::GetHandle | ( | ) |
References m_handle.
Referenced by con::Connection::getDesc().
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().
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().
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().
void UDPSocket::setTimeoutMs | ( | int | timeout_ms | ) |
References m_timeout_ms.
Referenced by con::Connection::Connection(), and init().
bool UDPSocket::WaitData | ( | int | timeout_ms | ) |
References dstream, infostream, and m_handle.
Referenced by Receive().
|
private |
Referenced by ~UDPSocket(), Bind(), GetHandle(), init(), Receive(), Send(), and WaitData().
|
private |
Referenced by Receive(), and setTimeoutMs().