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

Base class for all packets. More...

#include <IPacket.h>

Public Member Functions

 AZ_TYPE_INFO (IPacket, "{1B33BFE8-8A4B-44E3-8C8D-3B924093227C}")
 
virtual PacketType GetPacketType () const =0
 
virtual AZStd::unique_ptr< IPacketClone () const =0
 
virtual bool Serialize (ISerializer &serializer)=0
 

Detailed Description

Base class for all packets.

IPacket defines an abstract interface that all packets transmitted using AzNetworking must conform to. While there are a number of core packets used internally by AzNetworking, it is fully possible for end-users to define their own custom packets using this interface. PacketType should be distinct, and should be greater than AzNetworking::CorePackets::MAX. The Serialize method allows the IPacket to be used by an ISerializer to move data between hosts safely and efficiently.

For more information on the packet format and best practices for extending the packet system, read Networking Packets on the O3DE documentation site.

Member Function Documentation

◆ Clone()

virtual AZStd::unique_ptr<IPacket> AzNetworking::IPacket::Clone ( ) const
pure virtual

Returns an identical copy of the current packet instance, caller assumes ownership.

Returns
copy of the current packet instance, caller assumes ownership

◆ GetPacketType()

virtual PacketType AzNetworking::IPacket::GetPacketType ( ) const
pure virtual

Returns the packet type.

Returns
packet type

◆ Serialize()

virtual bool AzNetworking::IPacket::Serialize ( ISerializer serializer)
pure virtual

Base serialize method for all serializable structures or classes to implement.

Parameters
serializerISerializer instance to use for serialization
Returns
boolean true for success, false for serialization failure

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