wrapper class for managing UDP sockets.
More...
#include <UdpSocket.h>
Inherited by AzNetworking::DtlsSocket.
|
enum class | CanAcceptConnections { False
, True
} |
|
|
virtual bool | IsEncrypted () const |
|
virtual DtlsEndpoint::ConnectResult | ConnectDtlsEndpoint (DtlsEndpoint &dtlsEndpoint, const IpAddress &address, UdpPacketEncodingBuffer &outDtlsData) const |
|
virtual DtlsEndpoint::ConnectResult | AcceptDtlsEndpoint (DtlsEndpoint &dtlsEndpoint, const IpAddress &address) const |
|
virtual bool | Open (uint16_t port, CanAcceptConnections canAccept, TrustZone trustZone) |
|
virtual void | Close () |
| Closes an open socket.
|
|
bool | IsOpen () const |
|
int32_t | Send (const IpAddress &address, const uint8_t *data, uint32_t size, bool encrypt, DtlsEndpoint &dtlsEndpoint, const ConnectionQuality &connectionQuality) const |
|
int32_t | Receive (IpAddress &outAddress, uint8_t *outData, uint32_t size) const |
|
SocketFd | GetSocketFd () const |
|
uint32_t | GetSentPackets () const |
|
uint32_t | GetSentBytes () const |
|
uint32_t | GetSentPacketsEncrypted () const |
|
uint32_t | GetSentBytesEncryptionInflation () const |
|
uint32_t | GetRecvPackets () const |
|
uint32_t | GetRecvBytes () const |
|
|
uint32_t | m_sentPacketsEncrypted = 0 |
|
uint32_t | m_sentBytesEncryptionInflation = 0 |
|
wrapper class for managing UDP sockets.
◆ AcceptDtlsEndpoint()
virtual DtlsEndpoint::ConnectResult AzNetworking::UdpSocket::AcceptDtlsEndpoint |
( |
DtlsEndpoint & |
dtlsEndpoint, |
|
|
const IpAddress & |
address |
|
) |
| const |
|
virtual |
Accepts an encryption socket wrapper.
- Parameters
-
dtlsEndpoint | the encryption wrapper instance to create a connection over |
address | the IP address of the endpoint to connect to |
- Returns
- a connect result specifying whether the connection is still pending, failed, or complete
Reimplemented in AzNetworking::DtlsSocket.
◆ Close()
virtual void AzNetworking::UdpSocket::Close |
( |
| ) |
|
|
virtual |
◆ ConnectDtlsEndpoint()
Creates an encryption socket wrapper.
- Parameters
-
dtlsEndpoint | the encryption wrapper instance to create a connection over |
address | the IP address of the endpoint to connect to |
outDtlsData | data buffer to store the dtls handshake packet |
- Returns
- a connect result specifying whether the connection is still pending, failed, or complete
Reimplemented in AzNetworking::DtlsSocket.
◆ GetRecvBytes()
uint32_t AzNetworking::UdpSocket::GetRecvBytes |
( |
| ) |
const |
|
inline |
Returns the total number of bytes received on this socket.
- Returns
- the total number of bytes received on this socket
◆ GetRecvPackets()
uint32_t AzNetworking::UdpSocket::GetRecvPackets |
( |
| ) |
const |
|
inline |
Returns the total number of packets received on this socket.
- Returns
- the total number of packets received on this socket
◆ GetSentBytes()
uint32_t AzNetworking::UdpSocket::GetSentBytes |
( |
| ) |
const |
|
inline |
Returns the total number of bytes sent on this socket.
- Returns
- the total number of bytes sent on this socket
◆ GetSentBytesEncryptionInflation()
uint32_t AzNetworking::UdpSocket::GetSentBytesEncryptionInflation |
( |
| ) |
const |
|
inline |
Returns the total number of additional bytes sent on this socket due to SSL encryption.
- Returns
- the total number of additional bytes sent on this socket due to SSL encryption
◆ GetSentPackets()
uint32_t AzNetworking::UdpSocket::GetSentPackets |
( |
| ) |
const |
|
inline |
Returns the total number of packets sent on this socket.
- Returns
- the total number of packets sent on this socket
◆ GetSentPacketsEncrypted()
uint32_t AzNetworking::UdpSocket::GetSentPacketsEncrypted |
( |
| ) |
const |
|
inline |
Returns the total number of encrypted packets sent on this socket.
- Returns
- the total number of encrypted packets sent on this socket
◆ GetSocketFd()
SocketFd AzNetworking::UdpSocket::GetSocketFd |
( |
| ) |
const |
|
inline |
Returns the underlying socket file descriptor.
- Returns
- the underlying socket file descriptor
◆ IsEncrypted()
virtual bool AzNetworking::UdpSocket::IsEncrypted |
( |
| ) |
const |
|
virtual |
Returns true if this is an encrypted socket, false if not.
- Returns
- boolean true if this is an encrypted socket, false if not
Reimplemented in AzNetworking::DtlsSocket.
◆ IsOpen()
bool AzNetworking::UdpSocket::IsOpen |
( |
| ) |
const |
|
inline |
Returns true if the UDP socket is currently in an open state.
- Returns
- boolean true if the socket is in a connected state
◆ Open()
virtual bool AzNetworking::UdpSocket::Open |
( |
uint16_t |
port, |
|
|
CanAcceptConnections |
canAccept, |
|
|
TrustZone |
trustZone |
|
) |
| |
|
virtual |
Opens the UDP socket on the given port.
- Parameters
-
port | the port number to open the UDP socket on, 0 will bind to any available port |
canAccept | if true, the socket will be opened in a way that allows accepting incoming connections |
trustZone | for encrypted connections, the level of trust we associate with this connection (internal or external) |
- Returns
- boolean true on success
Reimplemented in AzNetworking::DtlsSocket.
◆ Receive()
int32_t AzNetworking::UdpSocket::Receive |
( |
IpAddress & |
outAddress, |
|
|
uint8_t * |
outData, |
|
|
uint32_t |
size |
|
) |
| const |
Receives a payload from the UDP socket.
- Parameters
-
outAddress | on success, the address of the endpoint that sent the data |
outData | on success, address to write the received data to |
size | maximum size the output buffer supports for receiving |
- Returns
- number of bytes received, <= 0 on error
◆ Send()
int32_t AzNetworking::UdpSocket::Send |
( |
const IpAddress & |
address, |
|
|
const uint8_t * |
data, |
|
|
uint32_t |
size, |
|
|
bool |
encrypt, |
|
|
DtlsEndpoint & |
dtlsEndpoint, |
|
|
const ConnectionQuality & |
connectionQuality |
|
) |
| const |
Sends a single payload over the UDP socket to the connected endpoint.
- Parameters
-
address | the address to send the payload to |
data | pointer to the data to send |
size | size of the payload in bytes |
encrypt | signals that the payload should be encrypted before transmitting if encryption is supported |
dtlsEndpoint | data required for DTLS encryption |
connectionQuality | debug connection quality parameters |
- Returns
- number of bytes sent, <= 0 on error
The documentation for this class was generated from the following files:
- Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpSocket.h
- Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpSocket.inl