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::IConnectionListener Class Referenceabstract

interface class for application layer dealing with connection level events. More...

#include <IConnectionListener.h>

Public Member Functions

virtual ConnectResult ValidateConnect (const IpAddress &remoteAddress, const IPacketHeader &packetHeader, ISerializer &serializer)=0
 
virtual void OnConnect (IConnection *connection)=0
 
virtual PacketDispatchResult OnPacketReceived (IConnection *connection, const IPacketHeader &packetHeader, ISerializer &serializer)=0
 
virtual void OnPacketLost (IConnection *connection, PacketId packetId)=0
 
virtual void OnDisconnect (IConnection *connection, DisconnectReason reason, TerminationEndpoint endpoint)=0
 

Detailed Description

interface class for application layer dealing with connection level events.

IConnectionListener defines an abstract interface that the user of AzNetworking is expected to implement to react and handle all IConnection related events, including the handling of any received IPacket derived packets. The AzNetworking user should derive a handler class from IConnectionListener, and provide an instance of that handler to any INetworkInterface the user instantiates. The lifetime of the IConnectionListener must outlive the lifetime of the INetworkInterface.

Member Function Documentation

◆ OnConnect()

virtual void AzNetworking::IConnectionListener::OnConnect ( IConnection connection)
pure virtual

Invoked when a new connection is successfully established.

Parameters
connectionpointer to the new connection instance

◆ OnDisconnect()

virtual void AzNetworking::IConnectionListener::OnDisconnect ( IConnection connection,
DisconnectReason  reason,
TerminationEndpoint  endpoint 
)
pure virtual

Called on disconnection from an connection.

Parameters
connectionpointer to the connection instance generating the event
reasonreason for the disconnect
endpointwhether the disconnection was initiated locally or remotely

◆ OnPacketLost()

virtual void AzNetworking::IConnectionListener::OnPacketLost ( IConnection connection,
PacketId  packetId 
)
pure virtual

Called when a packet is deemed lost by the remote connection.

Parameters
connectionpointer to the connection instance generating the event
packetIdidentifier of the lost packet

◆ OnPacketReceived()

virtual PacketDispatchResult AzNetworking::IConnectionListener::OnPacketReceived ( IConnection connection,
const IPacketHeader packetHeader,
ISerializer serializer 
)
pure virtual

Called on receipt of a packet from a connected connection.

Parameters
connectionpointer to the connection instance generating the event
packetHeaderpacket header of the associated payload
serializerserializer instance containing the transmitted payload
Returns
PacketDispatchResult result of the packet handling attempt

◆ ValidateConnect()

virtual ConnectResult AzNetworking::IConnectionListener::ValidateConnect ( const IpAddress remoteAddress,
const IPacketHeader packetHeader,
ISerializer serializer 
)
pure virtual

Invoked to validate any new incoming connection from a new endpoint.

Parameters
remoteAddressthe address of the remote endpoint initiating a connection
packetHeaderpacket header of the associated payload
serializerserializer instance containing the transmitted payload
Returns
the result of the application layers validation of the connect message

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