Open 3D Engine AzNetworking API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzNetworking::IConnection Class Referenceabstract

interface class for network connections. More...

#include <IConnection.h>

Inherited by AzNetworking::TcpConnection, and AzNetworking::UdpConnection.

Public Member Functions

 IConnection (ConnectionId connectionId, const IpAddress &address)
 
virtual bool SendReliablePacket (const IPacket &packet)=0
 
virtual PacketId SendUnreliablePacket (const IPacket &packet)=0
 
virtual bool WasPacketAcked (PacketId packetId) const =0
 
virtual ConnectionState GetConnectionState () const =0
 
virtual ConnectionRole GetConnectionRole () const =0
 
virtual bool Disconnect (DisconnectReason reason, TerminationEndpoint endpoint)=0
 
virtual void SetConnectionMtu (uint32_t connectionMtu)=0
 
virtual uint32_t GetConnectionMtu () const =0
 
ConnectionId GetConnectionId () const
 
void SetUserData (void *userData)
 
void * GetUserData () const
 
void SetRemoteAddress (const IpAddress &address)
 
const IpAddressGetRemoteAddress () const
 
const ConnectionMetricsGetMetrics () const
 
ConnectionMetricsGetMetrics ()
 
const ConnectionQualityGetConnectionQuality () const
 
ConnectionQualityGetConnectionQuality ()
 

Detailed Description

interface class for network connections.

IConnection provides a pure-virtual interface for all network connection types. IConnections provide access to a ConnectionMetrics object which provides a variety of metrics on the connection itself such as data rate, RTT and packet statistics.

Constructor & Destructor Documentation

◆ IConnection()

AzNetworking::IConnection::IConnection ( ConnectionId  connectionId,
const IpAddress address 
)
inline

Construct with a specific connectionId and remoteAddress.

Parameters
connectionIdthe connection identifier to use for this connection
addressthe remote address this connection

Member Function Documentation

◆ Disconnect()

virtual bool AzNetworking::IConnection::Disconnect ( DisconnectReason  reason,
TerminationEndpoint  endpoint 
)
pure virtual

Disconnects the connection with the provided termination reason

Parameters
reasonreason for the disconnect
endpointwhich endpoint initiated the disconnect, local or remote
Returns
boolean true on success

Implemented in AzNetworking::TcpConnection, and AzNetworking::UdpConnection.

◆ GetConnectionId()

ConnectionId AzNetworking::IConnection::GetConnectionId ( ) const
inline

Returns the connection identifier for this connection instance.

Returns
the connection identifier for this connection instance

◆ GetConnectionMtu()

virtual uint32_t AzNetworking::IConnection::GetConnectionMtu ( ) const
pure virtual

Returns the connection maximum transmission unit. Currently unsupported on TcpConnections

Returns
the max transmission unit for this connection

Implemented in AzNetworking::TcpConnection, and AzNetworking::UdpConnection.

◆ GetConnectionQuality() [1/2]

ConnectionQuality & AzNetworking::IConnection::GetConnectionQuality ( )
inline

Retrieves debug connection quality settings, non-const. Currently unsupported on TcpConnections

Returns
connection quality structure for this connection

◆ GetConnectionQuality() [2/2]

const ConnectionQuality & AzNetworking::IConnection::GetConnectionQuality ( ) const
inline

Retrieves debug connection quality settings. Currently unsupported on TcpConnections

Returns
connection quality structure for this connection

◆ GetConnectionRole()

virtual ConnectionRole AzNetworking::IConnection::GetConnectionRole ( ) const
pure virtual

Retrieves the connection role of this connection instance, whether it was initiated or accepted.

Returns
whether this connection was initiated or accepted

Implemented in AzNetworking::TcpConnection, and AzNetworking::UdpConnection.

◆ GetConnectionState()

virtual ConnectionState AzNetworking::IConnection::GetConnectionState ( ) const
pure virtual

Retrieves the connection state for this IConnection instance.

Returns
the current connection state for this IConnection instance

Implemented in AzNetworking::TcpConnection, and AzNetworking::UdpConnection.

◆ GetMetrics() [1/2]

ConnectionMetrics & AzNetworking::IConnection::GetMetrics ( )
inline

Retrieves connection metric info, non-const.

Returns
reference to the connection metric info

◆ GetMetrics() [2/2]

const ConnectionMetrics & AzNetworking::IConnection::GetMetrics ( ) const
inline

Retrieves connection metric info.

Returns
reference to the connection metric info

◆ GetRemoteAddress()

const IpAddress & AzNetworking::IConnection::GetRemoteAddress ( ) const
inline

Returns the remote address for this connection instance.

Returns
the remote address for this connection instance

◆ GetUserData()

void * AzNetworking::IConnection::GetUserData ( ) const
inline

Retrieves the connection user data bound to this instance.

Returns
the connection user data bound to this instance

◆ SendReliablePacket()

virtual bool AzNetworking::IConnection::SendReliablePacket ( const IPacket packet)
pure virtual

A helper function that transmits a packet on this connection reliably.

Parameters
packetpacket to transmit
Returns
boolean true if the packet was transmitted (not an indication of delivery)

Implemented in AzNetworking::TcpConnection, and AzNetworking::UdpConnection.

◆ SendUnreliablePacket()

virtual PacketId AzNetworking::IConnection::SendUnreliablePacket ( const IPacket packet)
pure virtual

A helper function that transmits a packet on this connection unreliably.

Parameters
packetpacket to transmit
Returns
the unreliable packet identifier of the transmitted packet

Implemented in AzNetworking::TcpConnection, and AzNetworking::UdpConnection.

◆ SetConnectionMtu()

virtual void AzNetworking::IConnection::SetConnectionMtu ( uint32_t  connectionMtu)
pure virtual

Sets connection maximum transmission unit for this connection. Currently unsupported on TcpConnections

Parameters
connectionMtuthe max transmission unit for this connection

Implemented in AzNetworking::TcpConnection, and AzNetworking::UdpConnection.

◆ SetRemoteAddress()

void AzNetworking::IConnection::SetRemoteAddress ( const IpAddress address)
inline

Sets the remote address for this connection instance.

Parameters
addressthe remote address to use for this connection instance

◆ SetUserData()

void AzNetworking::IConnection::SetUserData ( void *  userData)
inline

Sets connection user data to the provided value.

Parameters
userDatathe user data value to bind to this connection

◆ WasPacketAcked()

virtual bool AzNetworking::IConnection::WasPacketAcked ( PacketId  packetId) const
pure virtual

Returns true if the given packet id was confirmed acknowledged by the remote endpoint, false otherwise.

Parameters
packetIdthe packet id of the packet to confirm acknowledgment of
Returns
boolean true if the packet is confirmed acknowledged, false if the packet number is out of range, lost, or still pending acknowledgment

Implemented in AzNetworking::TcpConnection, and AzNetworking::UdpConnection.


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