UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FNetPacketNotify Class Reference

#include <NetPacketNotify.h>

Classes

struct  FNotificationHeader
 

Public Types

enum  { SequenceNumberBits = 14 }
 
enum  { MaxSequenceHistoryLength = 256 }
 
typedef TSequenceNumber< SequenceNumberBits, uint16SequenceNumberT
 
typedef TSequenceHistory< MaxSequenceHistoryLengthSequenceHistoryT
 

Public Member Functions

 FNetPacketNotify ()
 
void Init (SequenceNumberT InitialInSeq, SequenceNumberT InitialOutSeq)
 
void AckSeq (SequenceNumberT Seq)
 
void NakSeq (SequenceNumberT Seq)
 
SequenceNumberT CommitAndIncrementOutSeq ()
 
bool WriteHeader (FBitWriter &Writer, bool bRefresh=false)
 
bool ReadHeader (FNotificationHeader &Data, FBitReader &Reader) const
 
SequenceNumberT::DifferenceT GetSequenceDelta (const FNotificationHeader &NotificationData)
 
template<class Functor >
SequenceNumberT::DifferenceT Update (const FNotificationHeader &NotificationData, Functor &&InFunc)
 
const SequenceHistoryTGetInSeqHistory () const
 
SequenceNumberT GetInSeq () const
 
SequenceNumberT GetInAckSeq () const
 
SequenceNumberT GetOutSeq () const
 
SequenceNumberT GetOutAckSeq () const
 
bool CanSend () const
 
bool IsSequenceWindowFull (uint32 SafetyMargin=0U) const
 
SequenceNumberT::DifferenceT GetCurrentSequenceHistoryLength () const
 
bool IsWaitingForSequenceHistoryFlush () const
 

Detailed Description

FNetPacketNotify - Drives delivery of sequence numbers, acknowledgments and notifications of delivery sequence numbers

Member Typedef Documentation

◆ SequenceHistoryT

◆ SequenceNumberT

Member Enumeration Documentation

◆ anonymous enum

Enumerator
SequenceNumberBits 

◆ anonymous enum

Enumerator
MaxSequenceHistoryLength 

Constructor & Destructor Documentation

◆ FNetPacketNotify()

FNetPacketNotify::FNetPacketNotify ( )

Constructor

Member Function Documentation

◆ AckSeq()

void FNetPacketNotify::AckSeq ( SequenceNumberT  Seq)
inline

Mark Seq as received and update current InSeq, missing sequence numbers will be marked as lost

◆ CanSend()

bool FNetPacketNotify::CanSend ( ) const
inline

If we do have more unacknowledged sequence numbers in-flight than our maximum sendwindow we should not send more as the receiving end will not be able to detect if the sequence number has wrapped around

◆ CommitAndIncrementOutSeq()

FNetPacketNotify::SequenceNumberT FNetPacketNotify::CommitAndIncrementOutSeq ( )

Increment outgoing seq number and commit data

◆ GetCurrentSequenceHistoryLength()

FNetPacketNotify::SequenceNumberT::DifferenceT FNetPacketNotify::GetCurrentSequenceHistoryLength ( ) const

Get the current sequenceHistory length in bits, clamped to the maximum history length

◆ GetInAckSeq()

SequenceNumberT FNetPacketNotify::GetInAckSeq ( ) const
inline

Get the last received sequence number that we have accepted, InAckSeq cannot be larger than InSeq

◆ GetInSeq()

SequenceNumberT FNetPacketNotify::GetInSeq ( ) const
inline

Get the last received in sequence number

◆ GetInSeqHistory()

const SequenceHistoryT & FNetPacketNotify::GetInSeqHistory ( ) const
inline

Get the current SequenceHistory

◆ GetOutAckSeq()

SequenceNumberT FNetPacketNotify::GetOutAckSeq ( ) const
inline

Get the last outgoing sequence number acknowledged by remote

◆ GetOutSeq()

SequenceNumberT FNetPacketNotify::GetOutSeq ( ) const
inline

Get the current outgoing sequence number

◆ GetSequenceDelta()

SequenceNumberT::DifferenceT FNetPacketNotify::GetSequenceDelta ( const FNotificationHeader NotificationData)
inline

Gets the delta between the present sequence, and the sequence inside the specified header - if the delta is positive

◆ Init()

void FNetPacketNotify::Init ( SequenceNumberT  InitialInSeq,
SequenceNumberT  InitialOutSeq 
)

Init notification with expected initial sequence numbers

◆ IsSequenceWindowFull()

bool FNetPacketNotify::IsSequenceWindowFull ( uint32  SafetyMargin = 0U) const
inline

Return whether we can send packets without exhausting the packet sequence history window, as it could cause packets to be NAKed even when they've been received by the remote peer.

Parameters
SafetyMarginA small number representing how many packets you would like to keep as a safety margin for heart beats or other important packets.

◆ IsWaitingForSequenceHistoryFlush()

bool FNetPacketNotify::IsWaitingForSequenceHistoryFlush ( ) const
inline

Returns true if we are currently waiting for a flush of the sequence window

◆ NakSeq()

void FNetPacketNotify::NakSeq ( SequenceNumberT  Seq)
inline

Explicitly mark Seq as not received and update current InSeq, additional missing sequence numbers will be marked as lost

◆ ReadHeader()

bool FNetPacketNotify::ReadHeader ( FNotificationHeader Data,
FBitReader Reader 
) const

Read header from stream

◆ Update()

template<class Functor >
FNetPacketNotify::SequenceNumberT::DifferenceT FNetPacketNotify::Update ( const FNotificationHeader NotificationData,
Functor &&  InFunc 
)

Update state of PacketNotification based on received header and invoke packet notifications for received acks.

Parameters
NotificationDataThe header to update from
InFuncA function in the format (void)(FNetPacketNotify::SequenceNumberT AckedSequence, bool bDelivered) to handle packet notifications.
Returns
The > 0 delta of the incoming seq if within half the seq number space. 0 if the received seq is outside current window ,or the ack seq received is invalid.

◆ WriteHeader()

bool FNetPacketNotify::WriteHeader ( FBitWriter Writer,
bool  bRefresh = false 
)

Write NotificationHeader, and update outgoing ack record if bRefresh is true we will attempt to refresh a previously written header if the resulting size will be the same as the already written header. returns true if data was written, and false if no data was written which might be the case if we try to rewrite an existing header but the required size differs.


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