UNetConnection

Inheritance Hierarchy

Syntax

class UNetConnection : public UPlayer

Variables

Name Description

Public variable

bool

 

AllowMerge

Public variable

FNetConnAnalyti ...

 

AnalyticsVars

Net Analytics The locally cached/updated analytics variables, for the NetConnection - aggregated upon connection Close

Public variable

double

 

AverageFrameTime

Public variable

float

 

AvgLag

Public variable

float

 

BestLag

Public variable

double

 

BestLagAcc

Public variable

bool

 

bLastHasServerFrameTime

Public variable

bool

 

bNeedsByteSwapping

Whether this channel needs to byte swap all data or not

Public variable

uint32 : 1

 

bPendingDestroy

Public variable

bool

 

bResendAllDataSinceOpen

If true, will resend everything this connection has ever sent, since the connection has been open.

Public variable

FString

 

CDKeyHash

CD key authentication.

Public variable

FString

 

CDKeyResponse

Public variable

FString

 

Challenge

Public variable

TArray < UChanne ...

 

Channels

Public variable

TArray < class U ...

 

Children

Child connections for secondary viewports

Public variable

EClientLoginSta ...

 

ClientLoginState

Login state tracking.

Public variable

FString

 

ClientResponse

Public variable

TSet < FName >

 

ClientVisibleLevelNames

On the server, the package names of streaming levels that the client has told us it has made visible the server will only replicate references to Actors in visible levels so that it's impossible to send references to Actors the client has not initialized

Public variable

float

 

ConnectTime

Time when connection request was first initiated

Public variable

int32

 

CountedFrames

Public variable

double

 

CumulativeTime

Public variable

TArray < Delayed ...

 

Delayed

Delayed packet array

Public variable

TMap < UObject &...

 

DormantReplicatorMap

A list of replicators that belong to recently dormant actors/objects

Public variable

UNetDriver *...

 

Driver

Owning net driver

Public variable

uint32

 

EngineNetworkProtocolVersion

Network version.

Public variable

uint8

 

ExpectedClientLoginMsgType

Public variable

double

 

FrameTime

Public variable

uint32

 

GameNetworkProtocolVersion

Public variable

TUniquePtr < Pac ...

 

Handler

PacketHandler , for managing layered handler components, which modify packets as they are sent/received

Public variable

int32

 

InBytes

Bytes sent/received on this connection (accumulated during a StatPeriod)

Public variable

int32

 

InBytesPerSecond

Bytes sent/received on this connection (per second) - these are from previous StatPeriod interval

Public variable

int32

 

InitInReliable

Public variable

int32

 

InitOutReliable

Public variable

int32

 

InPacketId

Public variable

int32

 

InPackets

Packets sent/received on this connection (accumulated during a StatPeriod)

Public variable

int32

 

InPacketsLost

Packets lost on this connection (accumulated during a StatPeriod)

Public variable

int32

 

InPacketsPerSecond

Packets sent/received on this connection (per second) - these are from previous StatPeriod interval

Public variable

TArray < int32 >

 

InReliable

Public variable

uint32 : 1

 

InternalAck

Public variable

int32

 

InTotalBytes

Total bytes sent/received on this connection

Public variable

int32

 

InTotalPackets

Total packets sent/received on this connection

Public variable

int32

 

InTotalPacketsLost

Total packets lost on this connection

Public variable

TMap < FNetworkG ...

 

KeepProcessingActorChannelBunchesMap

This holds a list of actor channels that want to fully shutdown, but need to continue processing bunches before doing so

Public variable

double

 

LagAcc

Stat accumulators.

Public variable

int32

 

LagCount

Public variable

FBitWriterMark

 

LastEnd

Public variable

double

 

LastGoodPacketRealtime

Public variable

FOutBunch

 

LastOut

Public variable

FOutBunch *

 

LastOutBunch

Public variable

double

 

LastReceiveRealtime

Public variable

double

 

LastReceiveTime

Internal.

Public variable

float

 

LastRecvAckTime

The last time an ack was received

Public variable

double

 

LastSendTime

Public variable

FBitWriterMark

 

LastStart

Merge info.

Public variable

double

 

LastTickTime

Public variable

double

 

LastTime

Public variable

int32

 

LogCallCount

Public variable

double

 

LogCallLastTime

Log tracking.

Public variable

int32

 

LogSustainedCount

Public variable

FOnLowLevelSend

 

LowLevelSendDel

Delegate for hooking LowLevelSend

Public variable

int32

 

MaxChannelSize

Public variable

int32

 

MaxPacket

Public variable

int32

 

MaxPacketHandlerBits

The maximum number of bits all packet handlers will reserve

Public variable

TNetAnalyticsDa ...

 

NetAnalyticsData

The net analytics data holder for the NetConnection analytics, which is where analytics variables are aggregated upon Close

Public variable

int

 

NumAckBits

Number of bits used for acks in the current packet.

Public variable

int

 

NumBunchBits

Number of bits used for bunches in the current packet.

Public variable

int

 

NumPacketIdBits

Number of bits used for the packet id in the current packet.

Public variable

int

 

NumPaddingBits

Number of bits used for padding in the current packet.

Public variable

TArray < class U ...

 

OpenChannels

Public variable

int32

 

OutAckPacketId

Public variable

int32

 

OutBytes

Public variable

int32

 

OutBytesPerSecond

Public variable

uint8 [256]

 

OutBytesPerSecondHistory

Public variable

int32 [256]

 

OutLagPacketId

Public variable

double[256]

 

OutLagTime

Public variable

int32

 

OutPacketId

Public variable

int32

 

OutPackets

Public variable

int32

 

OutPacketsLost

Public variable

int32

 

OutPacketsPerSecond

Public variable

TArray < int32 >

 

OutReliable

Public variable

int32

 

OutTotalAcks

Total acks sent on this connection

Public variable

int32

 

OutTotalBytes

Public variable

int32

 

OutTotalPackets

Public variable

int32

 

OutTotalPacketsLost

Public variable

AActor *

 

OwningActor

Reference to controlling actor (usually PlayerController)

Public variable

UPackageMap ...

 

PackageMap

Package map between local and remote. (negotiates net serialization)

Public variable

TSubclassOf < UP ...

 

PackageMapClass

The class name for the PackageMap to be loaded

Public variable

int32

 

PacketOverhead

Negotiated parameters.

Public variable

FPacketSimulati ...

 

PacketSimulationSettings

For development.

Public variable

TArray < int32 >

 

PendingOutRec

Public variable

FUniqueNetIdRep ...

 

PlayerId

Net id of remote player on this connection. Only valid on client connections (server side).

Public variable

int32

 

QueuedBits

Public variable

FOnReceivedRawP ...

 

ReceivedRawPacketDel

Delegate for hooking ReceivedRawPacket

Public variable

float

 

RemoteSaturation

Public variable

FString

 

RequestURL

Public variable

int32

 

ResponseId

Public variable

FBitWriter

 

SendBuffer

Packet.

Public variable

FBitWriter

 

SendBunchHeader

The singleton buffer for sending bunch header information

Public variable

TArray < class A ...

 

SentTemporaries

This actor is bNetTemporary, which means it should never be replicated after it's initial packet is complete

Public variable

EConnectionStat ...

 

State

Public variable

TWeakPtr < State ...

 

StatelessConnectComponent

Reference to the PacketHandler component, for managing stateless connection handshakes

Public variable

float

 

StatPeriod

Interval between gathering stats

Public variable

double

 

StatUpdateTime

Stat display.

Public variable

int32

 

TickCount

Public variable

bool

 

TimeSensitive

Public variable

FURL

 

URL

Public variable

AActor *

 

ViewTarget

The actor that is currently being viewed/controlled by the owning controller

Constructors

Name Description

Public function

UNetConnection

(
    const FObjectInitializer & ObjectIn...
)

Public function

UNetConnection

(
    const FObjectInitializer & ObjectIn...
)

Constructors and destructors.

Functions

Name Description

Public function Const

FActorChanne ...

 

ActorChannelConstIterator()

Public function Const

const FActor ...

 

ActorChannelMap()

Public function Const

int32

 

ActorChannelsNum()

Public function

void

 

AddActorChannel

(
    AActor * Actor,
    UActorChannel * Channel
)

Public function

void

 

AddDestructionInfo

(
    FActorDestructionInfo * Destruc...
)

Public function Static

void

 

AddReferencedObjects

(
    UObject * InThis,
    FReferenceCollector & Collector
)

Public function Virtual

void

 

AssertValid()

Make sure this connection is in a reasonable state.

Public function Virtual

void

 

CleanUp()

Closes the control channel, cleans up structures, and prepares for deletion

Protected function

void

 

CleanupDormantActorState()

Public function

void

 

CleanupDormantReplicatorsForActor

(
    AActor * Actor
)

Removes Actor and its replicated components from DormantReplicatorMap.

Public function

void

 

CleanupStaleDormantReplicators()

Removes stale entries from DormantReplicatorMap.

Public function Virtual Const

bool

 

ClientHasInitializedLevelFor

(
    const AActor * TestActor
)

Returns whether the client has initialized the level required for the given object

Public function

void

 

Close()

Closes the connection (including sending a close notify across the network)

Public function

bool

 

ContainsActorChannel

(
    const TWeakObjectPtr < AActor >& Ac...
)

Public function

UChannel ...

 

CreateChannelByName

(
    const FName & ChName,
    EChannelCreateFlags CreateFlags,
    int32 ChannelIndex
)

Create a channel.

Public function Virtual

TSharedPtr < ...

 

CreateReplicatorForNewActorChannel

(
    UObject * Object
)

Called by UActorChannel .

Public function Virtual

FString

 

Describe()

Describe the connection.

Protected function Virtual

void

 

DestroyIgnoredActor

(
    AActor * Actor
)

Called internally to destroy an actor during replay fast-forward when the actor channel index will be recycled

Public function

void

 

EnableEncryption()

Enables encryption for the underlying encryption packet handler component.

Public function

void

 

EnableEncryptionWithKey

(
    TArrayView < const uint8 > Key
)

Sets the encryption key and enables encryption.

Public function

void

 

EnableEncryptionWithKeyServer

(
    TArrayView < const uint8 > Key
)

Sets the encryption key, enables encryption, and sends the encryption ack to the client.

Public function

UActorChanne ...

 

FindActorChannel

(
    const TWeakObjectPtr < AActor >& Ac...
)

Public function

UActorChanne ...

 

FindActorChannelRef

(
    const TWeakObjectPtr < AActor >& Ac...
)

Public function Virtual

void

 

FlushDormancy

(
    AActor * Actor
)

Public function

void

 

FlushDormancyForObject

(
    UObject * Object
)

Wrapper for validating an objects dormancy state, and to prepare the object for replication again

Public function Virtual

void

 

FlushNet

(
    bool bIgnoreSimulation
)

Flushes any pending data, bundling it into a packet and sending it via LowLevelSend() also handles network simulation settings (simulated lag, packet loss, etc) unless bIgnoreSimulation is true

Public function

void

 

ForcePropertyCompare

(
    AActor * Actor
)

Forces properties on this actor to do a compare for one frame (rather than share shadow state)

Public function

TMap < FStrin ...

 

GetActorsStarvedByClassTimeMap()

Returns the actor starvation map

Public function Virtual

int32

 

GetAddrAsInt()

Public function Virtual

int32

 

GetAddrPort()

Public function Const

FName

 

GetClientWorldPackageName()

Public function

UControlChan ...

 

GetControlChannel()

Public function

TSet < FNetwo ...

 

GetDestroyedStartupOrDormantActorGUIDs()

Public function Const

const UNetDr ...

 

GetDriver()

Public function

UNetDriver &...

 

GetDriver()

Public function

int64

 

GetFreeSendBufferBits()

Returns number of bits left in current packet that can be used without causing a flush.

Public function Virtual

TSharedPtr < ...

 

GetInternetAddr()

Return the platform specific FInternetAddr type, containing this connections address.

Public function Const

int32

 

GetMaxSingleBunchSizeBits()

The maximum number of bits allowed within a single bunch.

Public function Const

FHistogram

 

GetNetHistogram()

Public function

TArray < FOut ...

 

GetOutgoingBunches()

Returns the OutgoingBunches array, only to be used by UChannel::SendBunch

Public function Const

FName

 

GetPlayerOnlinePlatformName()

Returns the online platform name for the player on this connection.

Public function

UReplication ...

 

GetReplicationConnectionDriver()

Public function

float

 

GetTimeoutValue()

Return current timeout value that should be used

Public function Virtual

UChildConnec ...

 

GetUChildConnection()

Get the representation of a secondary splitscreen connection that reroutes calls to the parent connection

Public function

UVoiceChanne ...

 

GetVoiceChannel()

Public function Virtual Const

UWorld *

 

GetWorld()

Get the world the connection belongs to

Public function Virtual

void

 

HandleClientPlayer

(
    APlayerController * PC,
    UNetConnection * NetConnection
)

Handle the player controller client

Public function

bool

 

HasReceivedClientPacket()

Whether or not a client packet has been received - used serverside, to delay any packet sends

Public function Virtual

void

 

InitBase

(
    UNetDriver * InDriver,
    FSocket * InSocket,
    const FURL & InURL,
    EConnectionState InState,
    int32 InMaxPacket,
    int32 InPacketOverhead
)

Initialize common settings for this connection instance

Public function Virtual

void

 

InitConnection

(
    UNetDriver * InDriver,
    EConnectionState InState,
    const FURL & InURL,
    int32 InConnectionSpeed,
    int32 InMaxPacket
)

Initializes an "addressless" connection with the passed in settings

Public function Virtual

void

 

InitHandler()

Initializes the PacketHandler

Public function Virtual

void

 

InitLocalConnection

(
    UNetDriver * InDriver,
    FSocket * InSocket,
    const FURL & InURL,
    EConnectionState InState,
    int32 InMaxPacket,
    int32 InPacketOverhead
)

Initialize this connection instance to a remote source

Public function Virtual

void

 

InitRemoteConnection

(
    UNetDriver * InDriver,
    FSocket * InSocket,
    const FURL & InURL,
    const FInternetAddr & InRemoteAddr,
    EConnectionState InState,
    int32 InMaxPacket,
    int32 InPacketOverhead
)

Initialize this connection instance from a remote source

Public function Virtual

void

 

InitSendBuffer()

Resets the FBitWriter to its default state

Public function Virtual

void

 

InitSequence

(
    int32 IncomingSequence,
    int32 OutgoingSequence
)

Initializes the sequence numbers for the connection, usually from shared randomized data

Public function

bool

 

IsClientMsgTypeValid

(
    const uint8 ClientMsgType
)

This function validates that ClientMsgType is the next expected msg type.

Public function Const

bool

 

IsEncryptionEnabled()

Returns true if encryption is enabled for this connection.

Public function Virtual

int32

 

IsNetReady

(
    bool Saturate
)

Return whether this channel is ready for sending.

Public function Virtual

FString

 

LowLevelDescribe()

Public function Virtual

FString

 

LowLevelGetRemoteAddress

(
    bool bAppendPort
)

Public function Virtual

void

 

LowLevelSend

(
    void* Data,
    int32 CountBits,
    FOutPacketTraits & Traits
)

Sends a byte stream to the remote endpoint using the underlying socket

Public function Virtual

void

 

NotifyAnalyticsProvider()

Notification that the NetDriver analytics provider has been updated NOTE: Can also mean disabled, e.g. during hotfix

Public function

void

 

PopLastStart()

Pops the LastStart bits off of the send buffer, used for merging bunches

Public function

void

 

ReadInput

(
    float DeltaSeconds
)

Read input

Public function

void

 

ReceivedNak

(
    int32 NakPacketId
)

Packet was negatively acknowledged.

Public function

void

 

ReceivedPacket

(
    FBitReader & Reader
)

Handle a packet we just received.

Public function Virtual

void

 

ReceivedRawPacket

(
    void* Data,
    int32 Count
)

Allows the connection to process the raw data that was received

Public function Virtual

FString

 

RemoteAddressToString()

Gets a unique ID for the connection, this ID depends on the underlying connection For IP connections this is an IP Address and port, for steam this is a SteamID

Public function

void

 

RemoveActorChannel

(
    AActor * Actor
)

Actor Channel Accessors

Public function

void

 

RemoveDestructionInfo

(
    FActorDestructionInfo * Destruc...
)

Public function

void

 

ResetActorsStarvedByClassTimeMap()

Clears the actor starvation map

Public function

void

 

ResetDestructionInfos()

Public function

void

 

ResetGameWorldState()

Clear all Game specific state. Called during seamless travel

Public function

void

 

ResetPacketBitCounts()

Sets all of the bit-tracking variables to zero.

Public function

void

 

SendClientEncryptionAck()

Sends an NMT_EncryptionAck message

Public function

void

 

SendPackageMap()

Send package map to the remote.

Public function

int32

 

SendRawBunch

(
    FOutBunch & Bunch,
    bool InAllowMerge
)

Send a raw bunch.

Public function

void

 

SetClientLoginState

(
    const EClientLoginState::Type NewSt...
)

Wrapper for setting the current client login state, so we can trap for debugging, and verbosity purposes.

Public function

void

 

SetClientWorldPackageName

(
    FName NewClientWorldPackageName
)

Public function

void

 

SetEncryptionKey

(
    TArrayView < const uint8 > Key
)

Sets the key for the underlying encryption packet handler component, but doesn't modify encryption enabled state.

Public function

void

 

SetExpectedClientLoginMsgType

(
    const uint8 NewType
)

Wrapper for setting the current expected client login msg type.

Public function

void

 

SetIgnoreAlreadyOpenedChannels

(
    bool bInIgnoreAlreadyOpenedChannels
)

Sets whether or not we should ignore bunches that would attempt to open channels that are already open.

Public function

void

 

SetPlayerOnlinePlatformName

(
    const FName InPlayerOnlinePlatformN...
)

Sets the PlayerOnlinePlatformName member.

Public function

void

 

SetReplicationConnectionDriver

Public function

bool

 

ShouldReplicateVoicePacketFrom

(
    const FUniqueNetId & Sender
)

Called to determine if a voice packet should be replicated to this connection or any of its child connections

Public function

void

 

SlowAssertValid()

Make sure this connection is in a reasonable state.

Public function

void

 

StartTickingChannel

(
    UChannel * Channel
)

Adds the channel to the ticking channels list.

Public function

void

 

StopTickingChannel

(
    UChannel * Channel
)

Removes a channel from the ticking list directly

Public function

void

 

TearDownReplicationConnectionDriver()

Public function Virtual

void

 

Tick()

Poll the connection. If it is timed out, close it.

Public function

bool

 

TrackLogsPerSecond()

This function tracks the number of log calls per second for this client, and disconnects the client if it detects too many calls are made per second

Public function

void

 

UpdateLevelVisibility

(
    const FName & PackageName,
    bool bIsVisible
)

Called by PlayerController to tell connection about client level visiblity change

Public function

void

 

UpdatePacketSimulationSettings()

Copies the settings from the net driver to our local copy

Public function Virtual

void

 

ValidateSendBuffer()

Validates the FBitWriter to make sure it's not in an error state

Public function

int32

 

WriteBitsToSendBuffer

(
    const uint8 * Bits,
    const int32 SizeInBits,
    const uint8 * ExtraBits,
    const int32 ExtraSizeInBits,
    EWriteBitsDataType DataType
)

Appends the passed in data to the SendBuffer to be sent when FlushNet is called

Overridden from UObject

Name Description

Public function Virtual

void

 

FinishDestroy()

Called to finish destroying the object.

Public function Virtual

void

 

Serialize

(
    FArchive & Ar
)

Handles reading, writing, and reference collecting using FArchive .

Overridden from FExec

Name Description

Public function Virtual

bool

 

Exec

(
    UWorld * InWorld,
    const TCHAR * Cmd,
    FOutputDevice & Ar
)

Exec handler

Enums

Name

Description

Public enum

EWriteBitsDataType

What type of data is being written

Constants

Name

Description

DEFAULT_MAX_CHANNEL_SIZE

Channel table.

GNetConnectionBeingCleanedUp

: set to net connection currently inside CleanUp() , for HasClientLoadedCurrentWorld() to be able to find it during PlayerController destruction, since we clear its Player before destroying it.

Deprecated Functions

Name Description

Public function

UChannel ...

 

CreateChannel

(
    EChannelType Type,
    bool bOpenedLocally,
    int32 ChannelIndex
)

Use CreateChannelByName

Public function Virtual

void

 

InitHandler

(
    TSharedPtr < IAnalyticsProvider > In...
)

Analytics providers are now handled in the NetDriver

Public function Virtual

void

 

LowLevelSend

(
    void* Data,
    int32 CountBytes,
    int32 CountBits
)

Use the method that allows for packet traits for analytics and modification

Public function

void

 

PurgeAcks()

This method will be removed.

Public function Virtual

void

 

SendAck

(
    int32 PacketId,
    bool FirstTime
)

This method will be removed

References

Module

Engine

Header

Runtime/Engine/Classes/Engine/NetConnection.h