UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
NetConnection.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3//
4// A network connection.
5//
6
7#pragma once
8
9#include "UObject/ObjectKey.h"
14#include "Misc/EngineVersion.h"
15#include "Misc/NetworkGuid.h"
18#include "Engine/NetDriver.h"
19#include "Net/DataBunch.h"
20#include "Net/NetPacketNotify.h"
21#include "Engine/Player.h"
22#include "Engine/Channel.h"
27#include "ReplicationDriver.h"
34#include "Net/TrafficControl.h"
37#include "GameFramework/Actor.h"
38
39#include "NetConnection.generated.h"
40
41#define NETCONNECTION_HAS_SETENCRYPTIONKEY 1
42
44
45class FInternetAddr;
48class UActorChannel;
50class ULevelStreaming;
52class PacketHandler;
55
56namespace UE::Net
57{
58 class FNetPing;
59 class FNetConnectionFaultRecovery;
60 struct FStatelessHandshakeFailureInfo;
61
62} // end namespace UE::Net
63
65
67{
70
71#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
73#endif
74}
75
77
78/*-----------------------------------------------------------------------------
79 Types.
80-----------------------------------------------------------------------------*/
81enum { RELIABLE_BUFFER = 512 }; // Power of 2 >= 1.
82enum { MAX_PACKETID = FNetPacketNotify::SequenceNumberT::SeqNumberCount }; // Power of 2 >= 1, covering guaranteed loss/misorder time.
83enum { MAX_CHSEQUENCE = 1024 }; // Power of 2 >RELIABLE_BUFFER, covering loss/misorder time.
84enum { MAX_BUNCH_HEADER_BITS = 256 };
86enum { MAX_PACKET_INFO_HEADER_BITS = 1 /*bHasPacketInfo*/ + NetConnectionHelper::NumBitsForJitterClockTimeInHeader + 1 /*bHasServerFrameTime*/ + 8 /*ServerFrameTime*/};
89
90//
91// State of a connection.
92//
94{
95 USOCK_Invalid = 0, // Connection is invalid, possibly uninitialized.
96 USOCK_Closed = 1, // Connection permanently closed.
97 USOCK_Pending = 2, // Connection is awaiting connection.
98 USOCK_Open = 3, // Connection is open.
99 USOCK_Closing = 4, // Connection is closing and waiting for all reliable data to be acked. No new data will be sent.
100};
102
103namespace UE::Net
104{
107 {
108 ControlChannel, // The upgrade message came from the control channel
109 StatelessHandshake // The upgrade message came from the stateless handshake
110 };
111}
112
113
116{
117 enum Type
118 {
119 Invalid = 0, // This must be a client (which doesn't use this state) or uninitialized.
120 LoggingIn = 1, // The client is currently logging in.
121 Welcomed = 2, // Told client to load map and will respond with SendJoin
122 ReceivedJoin = 3, // NMT_Join received and a player controller has been created
123 CleanedUp = 4 // Cleanup has been called at least once, the connection is considered abandoned/terminated/gone
124 };
125
127 inline const TCHAR* ToString( const EClientLoginState::Type EnumVal )
128 {
129 switch (EnumVal)
130 {
131 case Invalid:
132 {
133 return TEXT("Invalid");
134 }
135 case LoggingIn:
136 {
137 return TEXT("LoggingIn");
138 }
139 case Welcomed:
140 {
141 return TEXT("Welcomed");
142 }
143 case ReceivedJoin:
144 {
145 return TEXT("ReceivedJoin");
146 }
147 case CleanedUp:
148 {
149 return TEXT("CleanedUp");
150 }
151 }
152 return TEXT("");
153 }
154};
155
158 {
159 None,
160 SinceOpen,
162 };
163
164// Delegates
165#if !UE_BUILD_SHIPPING
173DECLARE_DELEGATE_ThreeParams(FOnReceivedRawPacket, void* /*Data*/, int32 /*Count*/, bool& /*bBlockReceive*/);
174
182DECLARE_DELEGATE_ThreeParams(FOnLowLevelSend, void* /*Data*/, int32 /*Count*/, bool& /*bBlockSend*/);
183#endif
184
185
186#if DO_ENABLE_NET_TEST
190struct FDelayedPacket
191{
193 TArray<uint8> Data;
194
196 int32 SizeBits;
197
199 FOutPacketTraits Traits;
200
202 double SendTime = 0.0;
203
206
208 bool bSent = false;
209
210public:
211
213 : Data()
214 , SizeBits(InSizeBits)
215 , Traits(InTraits)
216 {
217 int32 SizeBytes = FMath::DivideAndRoundUp(SizeBits, 8);
218
219 Data.AddUninitialized(SizeBytes);
220 FMemory::Memcpy(Data.GetData(), InData, SizeBytes);
221 }
222
223 void CountBytes(FArchive& Ar) const
224 {
225 Data.CountBytes(Ar);
226 }
227};
228
230{
232
234 double ReinjectionTime = 0.0;
235
238
239 void CountBytes(FArchive& Ar) const
240 {
241 if (PacketData.IsValid())
242 {
243 PacketData->CountMemory(Ar);
244 }
245 Ar.CountBytes(sizeof(ReinjectionTime), sizeof(ReinjectionTime));
246 }
247};
248
249#endif //#if DO_ENABLE_NET_TEST
250
257
281
282UCLASS(customConstructor, Abstract, MinimalAPI, transient, config=Engine)
284{
287
289
290public:
294
296 UPROPERTY()
297 TObjectPtr<class UNetDriver> Driver;
298
300 UPROPERTY()
301 TSubclassOf<UPackageMap> PackageMapClass;
302
303 UPROPERTY()
305 TObjectPtr<class UPackageMap> PackageMap;
306
308 UPROPERTY()
309 TArray<TObjectPtr<class UChannel>> OpenChannels;
310
312 UPROPERTY()
313 TArray<TObjectPtr<class AActor>> SentTemporaries;
314
316 UPROPERTY()
317 TObjectPtr<class AActor> ViewTarget;
318
320 UPROPERTY()
321 TObjectPtr<class AActor> OwningActor;
322
323 UPROPERTY()
324 int32 MaxPacket; // Maximum packet size.
325
326private:
327 UPROPERTY()
328 uint32 InternalAck:1; // Internally ack all packets, for 100% reliable connections.
329
331 TMap<int32, TObjectPtr<class UChildConnection>> ChildrenLookup;
332
333 int32 NextServerNetPlayerIndex = 1;
334
335public:
336 bool IsInternalAck() const { return bInternalAck; }
337 void SetInternalAck(bool bValue)
338 {
339 bInternalAck = bValue;
341 InternalAck = bValue;
343 }
344
345 bool IsReplay() const { return bReplay; }
346 void SetReplay(bool bValue)
347 {
348 bReplay = bValue;
349 }
350
351 virtual bool IsReplayReady() const { return false; }
352
353 bool IsForceInitialDirty() const { return bForceInitialDirty; }
354 void SetForceInitialDirty(bool bValue)
355 {
356 bForceInitialDirty = bValue;
357 }
358
365 bool IsUnlimitedBunchSizeAllowed() const { return bUnlimitedBunchSizeAllowed; }
367 {
368 bUnlimitedBunchSizeAllowed = bValue;
369 }
370
373
374private:
375 uint32 bInternalAck : 1; // Internally ack all packets, for 100% reliable connections.
376 uint32 bReplay : 1; // Flag to indicate a replay connection, independent of reliability
377 uint32 bForceInitialDirty : 1; // Force all properties dirty on initial replication
378 uint32 bUnlimitedBunchSizeAllowed : 1; // Ignore the value of net.MaxConstructedPartialBunchSizeBytes
379
380public:
381 struct FURL URL; // URL of the other side.
382
385
386 // Track each type of bit used per-packet for bandwidth profiling
387
390
393
396
399
402
404 void ResetPacketBitCounts();
405
408 {
409 Unknown,
410 Bunch,
411 Ack
412 };
413
415 TMap<FString, TArray<float>>& GetActorsStarvedByClassTimeMap() { return ActorsStarvedByClassTimeMap; }
416
418 void ResetActorsStarvedByClassTimeMap() { ActorsStarvedByClassTimeMap.Empty(); }
419
421 ENGINE_API uint32 GetClientHandshakeId() const;
422
424 ENGINE_API void SetClientHandshakeId(uint32 InClientHandshakeId);
425
426private:
427 // Connection information.
428 EConnectionState State; // State this connection is in.
429
431 uint32 ClientHandshakeId = 0;
432
433public:
434 ENGINE_API const EConnectionState GetConnectionState() const;
435 ENGINE_API void SetConnectionState(EConnectionState ConnectionState);
436
438 ENGINE_API bool IsClosingOrClosed() const;
439
440 uint32 bPendingDestroy:1; // when true, playercontroller or beaconclient is being destroyed
441
442
445
448
449
453 UPROPERTY()
455
456 // Negotiated parameters.
457 int32 PacketOverhead; // Bytes overhead per packet sent.
458 FString Challenge; // Server-generated challenge.
459 FString ClientResponse; // Client-generated response.
460 FString RequestURL; // URL requested by client
461
462 UE_DEPRECATED(5.5, "Variable is deprecated and unassigned")
463 int32 ResponseId; // Id assigned by the server for linking responses to connections upon authentication
464
465 // Login state tracking
466 EClientLoginState::Type ClientLoginState;
467 uint8 ExpectedClientLoginMsgType; // Used to determine what the next expected control channel msg type should be from a connecting client
468
469 // Internal.
470 UPROPERTY()
471 double LastReceiveTime; // Last time a packet was received, for timeout checking.
472 double LastReceiveRealtime; // Last time a packet was received, using real time seconds (FPlatformTime::Seconds)
473 double LastGoodPacketRealtime; // Last real time a packet was considered valid
474 double LastSendTime; // Last time a packet was sent, for keepalives.
475 double LastTickTime; // Last time of polling.
476
482 int32 QueuedBits;
483
485 int32 TickCount;
486
488 uint32 LastProcessedFrame;
489
490 double GetLastRecvAckTime() const { return LastRecvAckTimestamp; }
491 double GetConnectTime() const { return ConnectTimestamp; }
492
493private:
495 double LastRecvAckTimestamp;
496
498 double ConnectTimestamp;
499
500 FPacketTimestamp LastOSReceiveTime; // Last time a packet was received at the OS/NIC layer
501 bool bIsOSReceiveTimeLocal; // Whether LastOSReceiveTime uses the same clock as the game, or needs translating
502
504 bool bSendBufferHasDummyPacketInfo = false;
505
507 FBitWriterMark HeaderMarkForPacketInfo;
508
510 int32 PreviousJitterTimeDelta;
511
513 double PreviousPacketSendTimeInS;
514
515public:
516 // Merge info.
517 FBitWriterMark LastStart; // Most recently sent bunch start.
518 FBitWriterMark LastEnd; // Most recently sent bunch end.
519 bool AllowMerge; // Whether to allow merging.
520 bool TimeSensitive; // Whether contents are time-sensitive.
521 FOutBunch* LastOutBunch; // Most recent outgoing bunch.
525
526 // Stat display.
531
533 float AvgLag;
534
536 double LagAcc;
539
541 double LastTime, FrameTime;
542
545
548
550 double RawPingInSeconds = 0.0;
551
553 float GetAverageJitterInMS() const { return AverageJitterInMS; }
554
557
559 int32 InBytes, OutBytes;
561 int32 InTotalBytes, OutTotalBytes;
563 int32 InPackets, OutPackets;
565 int32 InPacketsThisFrame = 0;
567 int32 OutPacketsThisFrame = 0;
569 int32 InTotalPackets, OutTotalPackets;
571 int32 InBytesPerSecond, OutBytesPerSecond;
573 int32 InPacketsPerSecond, OutPacketsPerSecond;
575 int32 InPacketsLost, OutPacketsLost;
577 int32 InTotalPacketsLost, OutTotalPacketsLost;
581 int32 TotalDelayedRPCs = 0;
582 int32 TotalDelayedRPCsFrameCount = 0;
583
584private:
586 int32 InTotalHandlerPackets;
587
589 double GracefulCloseTimeoutDeadline = 0.0;
590
591public:
593 {
594 return InTotalHandlerPackets;
595 }
596
599 const FNetConnectionPacketLoss& GetInLossPercentage() const { return InPacketsLossPercentage; }
600 const FNetConnectionPacketLoss& GetOutLossPercentage() const { return OutPacketsLossPercentage; }
601
602
603private:
604
605 FNetConnectionPacketLoss InPacketsLossPercentage;
606 FNetConnectionPacketLoss OutPacketsLossPercentage;
607
609 int32 StatPeriodCount;
610
617 float AverageJitterInMS;
618
619public:
620
625
628
629 // Packet.
630 FBitWriter SendBuffer; // Queued up bits waiting to send
631 double OutLagTime[256]; // The sent time of a packetId to calculate RTT from
632 int32 OutLagPacketId[256]; // Keep track of the packedId we stored the sent time for
633 uint8 OutBytesPerSecondHistory[256]; // For saturation measuring.
634 int32 InPacketId; // Full incoming packet index.
635 int32 OutPacketId; // Most recently sent packet.
636 int32 OutAckPacketId; // The id of the last ACK included in the current packet
637
638private:
639 int32 OutFirstAckPacketId = -1; // The id of the first ACK included in the current packet
640
641public:
642
644
645 // Channel table.
646
647 UPROPERTY(config)
648 int32 DefaultMaxChannelSize;
649
651 TArray<int32> OutReliable;
652 TArray<int32> InReliable;
653 TArray<int32> PendingOutRec; // Outgoing reliable unacked data from previous (now destroyed) channel in this slot. This contains the first chsequence not acked
654 int32 InitOutReliable;
655 int32 InitInReliable;
656
657 uint32 GetNetworkCustomVersion(const FGuid& VersionGuid) const;
658 void SetNetworkCustomVersions(const FCustomVersionContainer& CustomVersions);
659
660private:
661 FCustomVersionContainer NetworkCustomVersions;
662
663public:
664
665 // Log tracking
666 double LogCallLastTime;
667 int32 LogCallCount;
668 int32 LogSustainedCount;
669
671 UE::Net::FConnectionHandle GetConnectionHandle() const
672 {
673 return ConnectionHandle;
674 }
675
676 UE_DEPRECATED(5.6, "Use GetConnectionHandle() instead")
677 uint32 GetConnectionId() const
678 {
679 return ConnectionHandle.IsParentConnection() ? ConnectionHandle.GetParentConnectionId() : UE::Net::FConnectionHandle().GetParentConnectionId();
680 }
681
682 UE_DEPRECATED(5.6, "External code should not be setting connection IDs. For valid use cases SetConnectionHandle() should be used instead.")
683 void SetConnectionId(uint32 InConnectionId)
684 {
685 // Using this deprecated method will result in previous behavior which didn't support child connections in a meaningful way. We assume this is a parent connection.
686 ConnectionHandle = UE::Net::FConnectionHandle(InConnectionId);
687 }
688
690 UE_DEPRECATED(5.6, "Use GetConnectionHandle instead")
691 ENGINE_API uint32 GetParentConnectionId() const;
692
693 FNetTraceCollector* GetInTraceCollector() const;
694 FNetTraceCollector* GetOutTraceCollector() const;
695
697 AActor* GetConnectionViewTarget() const;
698
699 // ----------------------------------------------
700 // Actor Channel Accessors
701 // ----------------------------------------------
702
703 void RemoveActorChannel(AActor* Actor)
704 {
705 ActorChannels.Remove(Actor);
706 if (ReplicationConnectionDriver)
707 {
708 ReplicationConnectionDriver->NotifyActorChannelRemoved(Actor);
709 }
710 }
711
713 {
714 ActorChannels.Add(Actor, Channel);
715 if (ReplicationConnectionDriver)
716 {
717 ReplicationConnectionDriver->NotifyActorChannelAdded(Actor, Channel);
718 }
719 }
720
722 {
723 return ActorChannels.FindRef(Actor);
724 }
725
727 {
728 return ActorChannels.Find(Actor);
729 }
730
732 {
733 return ActorChannels.Contains(Actor);
734 }
735
737 {
738 return ActorChannels.Num();
739 }
740
741 FActorChannelMap::TConstIterator ActorChannelConstIterator() const
742 {
743 return ActorChannels.CreateConstIterator();
744 }
745
747 {
748 return ActorChannels;
749 }
750
752 {
753 return ReplicationConnectionDriver;
754 }
755
760
762 {
763 if (ReplicationConnectionDriver)
764 {
765 ReplicationConnectionDriver->TearDown();
766 ReplicationConnectionDriver = nullptr;
767 }
768 }
769
770private:
772 FActorChannelMap ActorChannels;
773
774 UReplicationConnectionDriver* ReplicationConnectionDriver;
775
777 FPackageFileVersion PackageVersionUE;
778
780 int32 PackageVersionLicenseeUE;
781
783 FEngineVersion EngineVersion;
784
785public:
788
791
794
796 void SetNetVersionsOnArchive(FArchive& Ar) const;
797
799 {
800 if (Driver && Driver->GetReplicationSystem())
801 {
802 return;
803 }
804 if (ReplicationConnectionDriver)
805 {
806 ReplicationConnectionDriver->NotifyAddDestructionInfo(DestructionInfo);
807 }
808 else
809 {
810 DestroyedStartupOrDormantActorGUIDs.Add(DestructionInfo->NetGUID);
811 }
812 }
813
815 {
816 if (Driver && Driver->GetReplicationSystem())
817 {
818 return;
819 }
820 if (ReplicationConnectionDriver)
821 {
822 ReplicationConnectionDriver->NotifyRemoveDestructionInfo(DestructionInfo);
823 }
824 else
825 {
826 DestroyedStartupOrDormantActorGUIDs.Remove(DestructionInfo->NetGUID);
827 }
828 }
829
831 {
832 if (Driver && Driver->GetReplicationSystem())
833 {
834 return;
835 }
836 if (ReplicationConnectionDriver)
837 {
838 ReplicationConnectionDriver->NotifyResetDestructionInfo();
839 }
840 else
841 {
842 DestroyedStartupOrDormantActorGUIDs.Reset();
843 }
844 }
845
846 TSet<FNetworkGUID>& GetDestroyedStartupOrDormantActorGUIDs() { return DestroyedStartupOrDormantActorGUIDs; }
847
848private:
849
855 TSet<FNetworkGUID> DestroyedStartupOrDormantActorGUIDs;
856
858 TSet<FName> ClientMakingVisibleLevelNames;
859
860public:
861
864
865private:
866
868
869public:
870
871 FName GetClientWorldPackageName() const { return ClientWorldPackageName; }
872
873 ENGINE_API void SetClientWorldPackageName(FName NewClientWorldPackageName);
874
881
883 ENGINE_API void UpdateLevelVisibility(const struct FUpdateLevelVisibilityLevelInfo& LevelVisibility);
884
885 const TSet<FName>& GetClientMakingVisibleLevelNames() const { return ClientMakingVisibleLevelNames; }
886
887#if DO_ENABLE_NET_TEST
888
890 FPacketSimulationSettings PacketSimulationSettings;
891
894
895private:
896
899
902
905
907 bool bIsReinjectingDelayedPackets = false;
908
910 double NextBufferBloatFlushOut = 0.0;
912 double NextBufferBloatFlushIn = 0.0;
913
915 double NextBufferBloatActiveTimeOut = 0.0;
916 double NextBufferBloatActiveTimeIn = 0.0;
917
920
923
924#endif //#if DO_ENABLE_NET_TEST
925
926public:
927
935
936#if !UE_BUILD_SHIPPING
939
942#endif
943
946 ENGINE_API TFunction<class ULocalPlayer*(UNetConnection*, APlayerController*)> GetLocalPlayerFunction();
947
959 UNetConnection* /* ChildGameServerConnection */,
960 APlayerController* /* PlayerController */,
961 UNetConnection* /* ParentGameServerConnection */);
962 FOnConnectionOpened& GetOnConnectionOpened() { return OnConnectionOpened; };
963
964private:
965
966 FOnConnectionOpened OnConnectionOpened;
967 TFunction<class ULocalPlayer*(UNetConnection*, APlayerController*)> PlayerConnectionFunction;
968
969public:
970
979 ENGINE_API bool ShouldReplicateVoicePacketFrom(const FUniqueNetId& Sender);
980
986
987 // Constructors and destructors.
989
991
992 //~ Begin UObject Interface.
993
994 ENGINE_API virtual void Serialize( FArchive& Ar ) override;
995
996 ENGINE_API virtual void FinishDestroy() override;
997
999
1005 ENGINE_API virtual UWorld* GetWorld() const override;
1006
1007 //~ End UObject Interface.
1008
1009
1010 //~ Begin FExec Interface.
1011#if UE_ALLOW_EXEC_COMMANDS
1012 ENGINE_API virtual bool Exec( UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar=*GLog ) override;
1013#endif
1014 //~ End FExec Interface.
1015
1017 void ReadInput( float DeltaSeconds );
1018
1024 {
1025 return NULL;
1026 }
1027
1030
1033
1035 ENGINE_API virtual FString Describe();
1036
1044 // @todo: Traits should be passed within bit readers/writers, eventually
1045 virtual void LowLevelSend(void* Data, int32 CountBits, FOutPacketTraits& Traits)
1046 PURE_VIRTUAL(UNetConnection::LowLevelSend,);
1047
1050
1053
1056
1062
1064 ENGINE_API virtual void Tick(float DeltaSeconds);
1065
1067 UE_DEPRECATED(5.6, "Replaced with a version that doesn't have a saturate option. Call Saturate() directly if passing true before." )
1069
1071 ENGINE_API virtual bool IsNetReady() const;
1072
1078
1085 ENGINE_API virtual void HandleClientPlayer( class APlayerController* PC, class UNetConnection* NetConnection );
1086
1089 {
1090 if (RemoteAddr.IsValid())
1091 {
1092 return RemoteAddr->GetPort();
1093 }
1094 return 0;
1095 }
1096
1099
1102
1109
1114
1122
1130
1135 void Close()
1136 {
1138 }
1139
1145 void Close(FNetCloseResult&& CloseReason)
1146 {
1147 Close(static_cast<FNetResult&&>(MoveTemp(CloseReason)));
1148 }
1149
1155 ENGINE_API void Close(FNetResult&& CloseReason);
1156
1157
1164 ENGINE_API void GracefulClose(FNetResult&& CloseReason);
1165
1172 virtual void GracefulClose(FNetCloseResult&& CloseReason)
1173 {
1174 GracefulClose(static_cast<FNetResult&&>(MoveTemp(CloseReason)));
1175 }
1176
1178 ENGINE_API virtual void CleanUp();
1179
1191
1203 virtual void InitRemoteConnection(UNetDriver* InDriver, class FSocket* InSocket, const FURL& InURL, const class FInternetAddr& InRemoteAddr, EConnectionState InState, int32 InMaxPacket = 0, int32 InPacketOverhead = 0) PURE_VIRTUAL(UNetConnection::InitRemoteConnection, );
1204
1216 virtual void InitLocalConnection(UNetDriver* InDriver, class FSocket* InSocket, const FURL& InURL, EConnectionState InState, int32 InMaxPacket = 0, int32 InPacketOverhead = 0) PURE_VIRTUAL(UNetConnection::InitLocalConnection, );
1217
1227
1232
1240
1246
1250 ENGINE_API void EnableEncryption(const FEncryptionData& EncryptionData);
1251
1255 ENGINE_API void EnableEncryptionServer(const FEncryptionData& EncryptionData);
1256
1260 ENGINE_API void SetEncryptionData(const FEncryptionData& EncryptionData);
1261
1266
1271
1276
1282 {
1283 if (RemoteAddr.IsValid())
1284 {
1285 return RemoteAddr->ToString(true);
1286 }
1287 return TEXT("Invalid");
1288 }
1289
1290
1293
1294 // Functions.
1295
1305 const uint8 * Bits,
1306 const int32 SizeInBits,
1307 const uint8 * ExtraBits = NULL,
1308 const int32 ExtraSizeInBits = 0,
1310
1313
1315 void PopLastStart();
1316
1321 ENGINE_API virtual bool ClientHasInitializedLevel(const ULevel* TestLevel) const;
1322
1327 UE_DEPRECATED(5.4, "ClientHasInitializedLevelFor is deprecated. Use ClientHasInitializedLevel and pass the actor's level (Actor->GetLevel()) instead.")
1329
1337
1341
1347
1350 const UNetDriver* GetDriver() const { return Driver; }
1351
1353 ENGINE_API UChannel* CreateChannelByName( const FName& ChName, EChannelCreateFlags CreateFlags, int32 ChannelIndex=INDEX_NONE );
1354
1360 ENGINE_API virtual void ReceivedPacket( FBitReader& Reader, bool bIsReinjectedPacket=false, bool bDispatchPacket=true );
1361
1367 ENGINE_API virtual void DispatchPacket( FBitReader& Reader, int32 PacketId, bool& bOutSkipAck, bool& bOutHasBunchErrors );
1368
1371
1373 void ResetGameWorldState();
1374
1377 {
1378#if DO_GUARD_SLOW
1379 AssertValid();
1380#endif
1381 }
1382
1386 ENGINE_API class UVoiceChannel* GetVoiceChannel();
1387
1388 ENGINE_API virtual void FlushDormancy(class AActor* Actor);
1389
1391 ENGINE_API void ForcePropertyCompare( AActor* Actor );
1392
1399 void FlushDormancyForObject(AActor* DormantActor, UObject* ReplicatedObject);
1400
1405 ENGINE_API virtual void SetClientLoginState( const EClientLoginState::Type NewState );
1406
1411 ENGINE_API void SetExpectedClientLoginMsgType( const uint8 NewType );
1412
1417 ENGINE_API bool IsClientMsgTypeValid( const uint8 ClientMsgType );
1418
1423 ENGINE_API bool TrackLogsPerSecond();
1424
1428 ENGINE_API virtual float GetTimeoutValue();
1429
1431 void StartTickingChannel(UChannel* Channel) { ChannelsToTick.AddUnique(Channel); }
1432
1434 void StopTickingChannel(UChannel* Channel) { ChannelsToTick.Remove(Channel); }
1435
1436 int32 GetNumTickingChannels() const { return ChannelsToTick.Num(); }
1437
1438 inline FHistogram GetNetHistogram() const { return NetConnectionHistogram; }
1439
1442 {
1443 // The InternalAck and ServerConnection conditions, are only there to exclude demo's and clients from this check,
1444 // so that the check is only performed on servers.
1445 return IsInternalAck() || Driver->ServerConnection != nullptr || InReliable[0] != InitInReliable;
1446 }
1447
1452 ENGINE_API void SetPlayerOnlinePlatformName(const FName InPlayerOnlinePlatformName);
1453
1455 FName GetPlayerOnlinePlatformName() const { return PlayerOnlinePlatformName; }
1456
1458 void SetAllowExistingChannelIndex(bool bAllow);
1459
1460private:
1461 void RestoreRemappedChannel(const int32 ChIndex);
1462
1463public:
1464
1469 void SetIgnoreActorBunches(bool bInIgnoreActorBunches, TSet<FNetworkGUID>&& InIgnoredBunchGuids);
1470
1475 void SetReserveDestroyedChannels(bool bInReserveChannels);
1476
1477 bool IsReservingDestroyedChannels() const { return bReserveDestroyedChannels; }
1478
1479 void AddReservedChannel(int32 ChIndex) { ReservedChannels.Add(ChIndex); }
1480
1485 void SetIgnoreReservedChannels(bool bInIgnoreReservedChannels);
1486
1488 TArray<FOutBunch *>& GetOutgoingBunches() { return OutgoingBunches; }
1489
1491 void StoreDormantReplicator(AActor* OwnerActor, UObject* Object, const TSharedRef<FObjectReplicator>& ObjectReplicator);
1492
1494 TSharedPtr<FObjectReplicator> FindAndRemoveDormantReplicator(AActor* OwnerActor, UObject* Object);
1495
1497 void RemoveDormantReplicator(AActor* Actor, UObject* Object);
1498
1500 void CleanupDormantReplicatorsForActor(AActor* Actor);
1501
1503 ENGINE_API void ExecuteOnAllDormantReplicators(UE::Net::FExecuteForEachDormantReplicator ExecuteFunction);
1504
1506 void ExecuteOnAllDormantReplicatorsOfActor(AActor* OwnerActor, UE::Net::FExecuteForEachDormantReplicator ExecuteFunction);
1507
1509 void CleanupStaleDormantReplicators();
1510
1512 void PreTickDispatch();
1513
1515 void PostTickDispatch();
1516
1522 void FlushPacketOrderCache(bool bFlushWholeCache=false);
1523
1530 {
1531 return TotalOutOfOrderPacketsLost + TotalOutOfOrderPacketsRecovered + TotalOutOfOrderPacketsDuplicate;
1532 }
1533
1540 {
1541 return TotalOutOfOrderPacketsLost;
1542 }
1543
1550 {
1551 return TotalOutOfOrderPacketsRecovered;
1552 }
1553
1560 {
1561 return TotalOutOfOrderPacketsDuplicate;
1562 }
1563
1571 {
1572 LastOSReceiveTime = InOSReceiveTime;
1573 bIsOSReceiveTimeLocal = bInIsOSReceiveTimeLocal;
1574 }
1575
1577 virtual void NotifyActorNetGUID(UActorChannel* Channel) {}
1578
1584 ENGINE_API void ConsumeQueuedActorDelinquencyAnalytics(FNetQueuedActorDelinquencyAnalytics& Out);
1585
1587 ENGINE_API const FNetQueuedActorDelinquencyAnalytics& GetQueuedActorDelinquencyAnalytics() const;
1588
1590 ENGINE_API void ResetQueuedActorDelinquencyAnalytics();
1591
1597 ENGINE_API void ConsumeSaturationAnalytics(FNetConnectionSaturationAnalytics& Out);
1598
1600 ENGINE_API const FNetConnectionSaturationAnalytics& GetSaturationAnalytics() const;
1601
1603 ENGINE_API void ResetSaturationAnalytics();
1604
1610 ENGINE_API void ConsumePacketAnalytics(FNetConnectionPacketAnalytics& Out);
1611
1613 ENGINE_API const FNetConnectionPacketAnalytics& GetPacketAnalytics() const;
1614
1616 ENGINE_API void ResetPacketAnalytics();
1617
1624 ENGINE_API void TrackReplicationForAnalytics(const bool bWasSaturated);
1625
1629 uint32 GetOutTotalNotifiedPackets() const { return OutTotalNotifiedPackets; }
1630
1632 ENGINE_API void SendChallengeControlMessage();
1633
1635 void SendChallengeControlMessage(const FEncryptionKeyResponse& Response);
1636
1638 {
1639 return bConnectionPendingCloseDueToReplicationFailure;
1640 }
1641
1642 ENGINE_API void SetPendingCloseDueToReplicationFailure();
1643
1645 ENGINE_API virtual void NotifyActorDestroyed(AActor* Actor, bool IsSeamlessTravel = false);
1646
1647 ENGINE_API virtual void NotifyActorChannelCleanedUp(UActorChannel* Channel, EChannelCloseReason CloseReason);
1648
1650 FNetLevelVisibilityTransactionId UpdateLevelStreamStatusChangedTransactionId(const ULevelStreaming* LevelObject, const FName PackageName, bool bShouldBeVisible);
1651
1652protected:
1653
1655 {
1656 return bConnectionPendingCloseDueToSocketSendFailure;
1657 }
1658
1659 ENGINE_API void SetPendingCloseDueToSocketSendFailure();
1660
1661 void CleanupDormantActorState();
1662
1663 void ClearDormantReplicatorsReference();
1664
1666 ENGINE_API virtual void DestroyOwningActor();
1667
1669 ENGINE_API virtual void DestroyIgnoredActor(AActor* Actor);
1670
1672 ENGINE_API virtual void HandleConnectionTimeout(const FString& Error);
1673
1677 ENGINE_API void NotifyConnectionUpdated();
1678
1682 ENGINE_API int32 GetLastNotifiedPacketId() const;
1683
1684private:
1691 UPROPERTY()
1692 TArray<TObjectPtr<UChannel>> ChannelsToTick;
1693
1695 FHistogram NetConnectionHistogram;
1696
1698 FName PlayerOnlinePlatformName;
1699
1701 mutable TMap<FName, bool> ClientVisibleActorOuters;
1702
1704 TMap<FName, FUpdateLevelVisibilityLevelInfo> PendingUpdateLevelVisibility;
1705
1707 TMap<FName, FNetLevelVisibilityTransactionId> ClientPendingStreamingStatusRequest;
1708
1709private:
1710
1712 void OnStatelessHandshakeFailure(UE::Net::FStatelessHandshakeFailureInfo HandshakeFailureInfo);
1713
1715 void UpdateLevelVisibilityInternal(const struct FUpdateLevelVisibilityLevelInfo& LevelVisibility);
1716
1718 bool UpdateCachedLevelVisibility(const FName& PackageName) const;
1719
1721 void UpdateAllCachedLevelVisibility() const;
1722
1724#if DO_ENABLE_NET_TEST
1726#endif
1727
1732#if DO_ENABLE_NET_TEST
1735#endif
1736
1738 void WritePacketHeader(FBitWriter& Writer);
1739
1741 void WriteDummyPacketInfo(FBitWriter& Writer);
1742
1744 void WriteFinalPacketInfo(FBitWriter& Writer, double PacketSentTimeInS);
1745
1747 bool ReadPacketInfo(FBitReader& Reader, bool bHasPacketInfoPayload, FEngineNetworkCustomVersion::Type EngineNetVer);
1748
1751
1753 void ProcessJitter(uint32 PacketJitterClockTimeMS);
1754
1756 void PrepareWriteBitsToSendBuffer(const int32 SizeInBits, const int32 ExtraSizeInBits);
1757
1760 int32 WriteBitsToSendBufferInternal(
1761 const uint8 * Bits,
1762 const int32 SizeInBits,
1763 const uint8 * ExtraBits,
1764 const int32 ExtraSizeInBits,
1765 EWriteBitsDataType DataType = EWriteBitsDataType::Unknown);
1766
1771 FName ClientWorldPackageName;
1772
1774 TMap<FString, TArray<float>> ActorsStarvedByClassTimeMap;
1775
1777 TMap<int32, FNetworkGUID> IgnoringChannels;
1778
1780 TMap<int32, int32> ChannelIndexMap;
1781
1782 bool bAllowExistingChannelIndex;
1783
1785 TSet<FNetworkGUID> IgnoredBunchGuids;
1786
1788 TSet<int32> IgnoredBunchChannels;
1789
1790 bool bIgnoreActorBunches;
1791
1793 TSet<int32> ReservedChannels;
1794
1795 bool bReserveDestroyedChannels;
1796 bool bIgnoreReservedChannels;
1797
1799 TArray<FOutBunch*> OutgoingBunches;
1800
1802 FWrittenChannelsRecord ChannelRecord;
1803
1805 FNetPacketNotify PacketNotify;
1806
1808 int32 LastNotifiedPacketId;
1809
1811 uint32 OutTotalNotifiedPackets;
1812
1814 uint32 HasDirtyAcks;
1815
1817 bool bHasWarnedAboutChannelLimit;
1818
1820 bool bConnectionPendingCloseDueToSocketSendFailure;
1821
1823 bool bConnectionPendingCloseDueToReplicationFailure;
1824
1825 FNetworkGUID GetActorGUIDFromOpenBunch(FInBunch& Bunch);
1826
1830 int32 TotalOutOfOrderPacketsLost = 0;
1831
1833 int32 TotalOutOfOrderPacketsRecovered = 0;
1834
1836 int32 TotalOutOfOrderPacketsDuplicate = 0;
1837
1840
1842 int32 PacketOrderCacheStartIdx;
1843
1845 int32 PacketOrderCacheCount;
1846
1847 FNetConnectionSaturationAnalytics SaturationAnalytics;
1848 FNetConnectionPacketAnalytics PacketAnalytics;
1849
1851 bool bFlushingPacketOrderCache;
1852
1854 UE::Net::FConnectionHandle ConnectionHandle;
1855
1856#if UE_NET_TRACE_ENABLED
1860 uint32 NetTraceId = 0;
1861#endif
1862
1866 bool bFlushedNetThisFrame = false;
1867
1869 AActor* RepContextActor;
1870 ULevel* RepContextLevel;
1871
1872 friend struct FScopedRepContext;
1873
1874 bool bAutoFlush;
1875
1877 bool bLoggedFlushNetQueuedBitsOverflow = false;
1878
1881
1884
1886 bool bReceivedCloseReason = false;
1887
1890
1893
1894
1895 int32 GetFreeChannelIndex(const FName& ChName) const;
1896
1897public:
1898 AActor* GetRepContextActor() const { return RepContextActor; }
1899 ULevel* GetRepContextLevel() const { return RepContextLevel; }
1900
1901 bool GetAutoFlush() const { return bAutoFlush; }
1902 void SetAutoFlush(bool bValue) { bAutoFlush = bValue; }
1903
1905 {
1906 return RPCDoS.Get();
1907 }
1908
1909 UE::Net::FNetConnectionFaultRecovery* GetFaultRecovery()
1910 {
1911 return FaultRecovery.Get();
1912 }
1913
1915 {
1916 return NetPing.Get();
1917 }
1918
1926 {
1927 SendCloseReason(static_cast<FNetResult&&>(MoveTemp(CloseReason)));
1928 }
1929
1936 ENGINE_API void SendCloseReason(FNetResult&& CloseReason);
1937
1943 ENGINE_API void HandleReceiveCloseReason(const FString& CloseReasonList);
1944
1953 ENGINE_API bool HandleReceiveNetUpgrade(uint32 RemoteNetworkVersion, EEngineNetworkRuntimeFeatures RemoteNetworkFeatures,
1955
1956private:
1962 void HandleNetResultOrClose(ENetCloseResult InResult);
1963
1967 void TryClosePendingGracefulClose();
1968
1969protected:
1971
1972 void InitChannelData();
1973
1975 {
1976 ConnectionHandle = Handle;
1977 }
1978
1979public:
1987 UE::Net::FDormantObjectMap* GetDormantFlushedObjectsForActor(AActor* Actor);
1988
1994 void ClearDormantFlushedObjectsForActor(AActor* Actor);
1995};
1996
1998{
1999public:
2001
2003 : Connection(InConnection)
2004 {
2005 if (Connection)
2006 {
2007 check(!Connection->RepContextActor);
2008 check(!Connection->RepContextLevel);
2009
2010 Connection->RepContextLevel = InLevel;
2011 }
2012 }
2013
2015 {
2016 if (Connection)
2017 {
2018 Connection->RepContextActor = nullptr;
2019 Connection->RepContextLevel = nullptr;
2020 }
2021 }
2022
2027
2028private:
2029 UNetConnection* Connection;
2030};
2031
2034{
2036 {
2037#if DO_ENABLE_NET_TEST
2038 PacketLag = InConnection->PacketSimulationSettings.PktLag;
2039 PacketLoss = InConnection->PacketSimulationSettings.PktLoss;
2040#else
2041 PacketLag = 0;
2042 PacketLoss = 0;
2043#endif
2044 }
2045
2051
2052 void ApplyTo(UNetConnection* Connection)
2053 {
2054#if DO_ENABLE_NET_TEST
2055 Connection->PacketSimulationSettings.PktLag = PacketLag;
2056 Connection->PacketSimulationSettings.PktLoss = PacketLoss;
2057#endif
2058 }
2059
2062};
2063
2092
2094UCLASS(transient, config=Engine, MinimalAPI)
2097{
2099public:
2100
2101 virtual void LowLevelSend(void* Data, int32 CountBits, FOutPacketTraits& Traits) override { }
2102 ENGINE_API void HandleClientPlayer( APlayerController* PC, UNetConnection* NetConnection ) override;
2103 virtual FString LowLevelGetRemoteAddress(bool bAppendPort=false) override { return FString(); }
2104 virtual bool ClientHasInitializedLevel(const ULevel* TestLevel) const override { return true; }
2105
2106 virtual void DestroyOwningActor() override { /* Don't destroy the OwningActor since we follow a real PlayerController*/ }
2107
2108 virtual TSharedPtr<const FInternetAddr> GetRemoteAddr() override { return nullptr; }
2109
2112
2113 virtual FString LowLevelDescribe() override { return TEXT("Simulated Client"); }
2114
2115};
2116
2117#if UE_NET_TRACE_ENABLED
2120#else
2123#endif
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define NULL
Definition oodle2base.h:134
#define check(expr)
Definition AssertionMacros.h:314
#define GLog
Definition CoreGlobals.h:95
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define PURE_VIRTUAL(func,...)
Definition CoreMiscDefines.h:103
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
EChannelCloseReason
Definition CoreNetTypes.h:49
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DELEGATE_ThreeParams(DelegateName, Param1Type, Param2Type, Param3Type)
Definition DelegateCombinations.h:66
EChannelCreateFlags
Definition Channel.h:41
return true
Definition ExternalRpcRegistry.cpp:601
JsonWriter Close()
auto Response
Definition ExternalRpcRegistry.cpp:598
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
#define LLM_DECLARE_TAG_API(...)
Definition LowLevelMemTracker.h:1117
ENetCloseResult
Definition NetCloseResult.h:24
EResendAllDataState
Definition NetConnection.h:158
@ MAX_PACKET_RELIABLE_SEQUENCE_HEADER_BITS
Definition NetConnection.h:85
TMap< TWeakObjectPtr< AActor >, UActorChannel *, FDefaultSetAllocator, TWeakObjectPtrMapKeyFuncs< TWeakObjectPtr< AActor >, UActorChannel * > > FActorChannelMap
Definition NetConnection.h:64
@ MAX_PACKETID
Definition NetConnection.h:82
ENGINE_API TAutoConsoleVariable< int32 > CVarNetEnableCongestionControl
@ MAX_CHSEQUENCE
Definition NetConnection.h:83
TArray< FChannelCloseInfo, TInlineAllocator< 8 > > FChannelsToClose
Definition NetConnection.h:256
@ MAX_PACKET_HEADER_BITS
Definition NetConnection.h:87
EConnectionState
Definition NetConnection.h:94
@ USOCK_Closing
Definition NetConnection.h:99
@ USOCK_Closed
Definition NetConnection.h:96
@ USOCK_Invalid
Definition NetConnection.h:95
@ USOCK_Pending
Definition NetConnection.h:97
@ USOCK_Open
Definition NetConnection.h:98
@ MAX_PACKET_INFO_HEADER_BITS
Definition NetConnection.h:86
@ MAX_PACKET_TRAILER_BITS
Definition NetConnection.h:88
ENGINE_API const TCHAR * LexToString(const EConnectionState Value)
Definition NetConnection.cpp:1052
@ MAX_BUNCH_HEADER_BITS
Definition NetConnection.h:84
@ RELIABLE_BUFFER
Definition NetConnection.h:81
EEngineNetworkRuntimeFeatures
Definition NetworkVersion.h:45
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
if(Failed) console_printf("Failed.\n")
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Actor.h:257
Definition PlayerController.h:261
Definition Engine.Build.cs:7
Definition Archive.h:1208
virtual void CountBytes(SIZE_T InNum, SIZE_T InMax)
Definition Archive.h:125
Definition CustomVersion.h:111
Definition ContainerAllocationPolicies.h:1660
Definition EngineVersion.h:12
virtual CORE_API bool Exec(UWorld *InWorld, const TCHAR *Cmd, FOutputDevice &Ar)
Definition Exec.cpp:30
Definition DataBunch.h:127
Definition IPAddress.h:22
virtual void GetPort(int32 &OutPort) const
Definition IPAddress.h:86
virtual FString ToString(bool bAppendPort) const =0
Definition NameTypes.h:617
Definition NetPacketNotify.h:39
Definition NetworkGuid.h:12
Definition UObjectGlobals.h:1292
static COREUOBJECT_API FObjectInitializer & Get()
Definition UObjectGlobals.cpp:5001
Definition DataReplication.h:74
Definition DataBunch.h:24
Definition OutputDevice.h:133
Definition RPCDoSDetection.h:419
Definition UObjectGlobals.h:2492
Definition Sockets.h:19
Definition CoreOnline.h:102
Definition ObjectMacros.h:180
Definition PacketHandler.Build.cs:7
Definition StatelessConnectHandlerComponent.h:119
Definition Array.h:670
Definition IConsoleManager.h:1792
Definition AssetRegistryState.h:50
Definition AndroidPlatformMisc.h:14
Definition UnrealString.h.inl:34
Definition ResizableCircularQueue.h:21
static constexpr SIZE_T MaxSizeInBits
Definition SequenceHistory.h:21
@ SeqNumberCount
Definition SequenceNumber.h:22
Definition SharedPointer.h:692
UE_FORCEINLINE_HINT const bool IsValid() const
Definition SharedPointer.h:1085
Definition SharedPointer.h:153
Definition SubclassOf.h:30
Definition UniquePtr.h:107
UE_FORCEINLINE_HINT T * Get() const
Definition UniquePtr.h:324
Definition SharedPointer.h:1295
Definition ActorChannel.h:78
Definition Channel.h:63
int32 ChIndex
Definition Channel.h:86
virtual void ReceivedBunch(FInBunch &Bunch) PURE_VIRTUAL(UChannel virtual ENGINE_API void ReceivedAck(int32 AckPacketId)
Definition Channel.h:120
Definition ChildConnection.h:28
Definition ConnectionHandle.h:17
uint32 GetParentConnectionId() const
Definition ConnectionHandle.h:78
Definition NetPing.h:136
Definition LevelStreaming.h:139
Definition Level.h:423
Definition LocalPlayer.h:169
Definition NetConnection.h:284
TMap< FNetworkGUID, TArray< TObjectPtr< class UActorChannel > > > KeepProcessingActorChannelBunchesMap
Definition NetConnection.h:863
ENGINE_API void EnableEncryptionServer(const FEncryptionData &EncryptionData)
Definition NetConnection.cpp:853
ENGINE_API void SetEncryptionData(const FEncryptionData &EncryptionData)
Definition NetConnection.cpp:879
TSet< FName > ClientVisibleLevelNames
Definition NetConnection.h:880
void AddReservedChannel(int32 ChIndex)
Definition NetConnection.h:1479
double StatUpdateTime
Definition NetConnection.h:528
virtual ENGINE_API FString Describe()
Definition NetConnection.cpp:1344
virtual ENGINE_API void ReceivedPacket(FBitReader &Reader, bool bIsReinjectedPacket=false, bool bDispatchPacket=true)
Definition NetConnection.cpp:3143
FNetConnAnalyticsVars AnalyticsVars
Definition NetConnection.h:624
void AddDestructionInfo(FActorDestructionInfo *DestructionInfo)
Definition NetConnection.h:798
virtual UChildConnection * GetUChildConnection()
Definition NetConnection.h:1023
FOnReceivedRawPacket ReceivedRawPacketDel
Definition NetConnection.h:938
virtual FString RemoteAddressToString()
Definition NetConnection.h:1281
float AvgLag
Definition NetConnection.h:533
bool HasReceivedClientPacket()
Definition NetConnection.h:1441
bool IsReservingDestroyedChannels() const
Definition NetConnection.h:1477
const FActorChannelMap & ActorChannelMap() const
Definition NetConnection.h:746
FBitWriter SendBunchHeader
Definition NetConnection.h:524
bool IsReplay() const
Definition NetConnection.h:345
TSharedPtr< FInternetAddr > RemoteAddr
Definition NetConnection.h:384
int NumPaddingBits
Definition NetConnection.h:398
void TearDownReplicationConnectionDriver()
Definition NetConnection.h:761
void ReceivedNak(int32 NakPacketId)
Definition NetConnection.cpp:2751
virtual void GracefulClose(FNetCloseResult &&CloseReason)
Definition NetConnection.h:1172
AActor * GetRepContextActor() const
Definition NetConnection.h:1898
int NumBunchBits
Definition NetConnection.h:392
TArray< FOutBunch * > & GetOutgoingBunches()
Definition NetConnection.h:1488
bool GetPendingCloseDueToReplicationFailure() const
Definition NetConnection.h:1637
void SetAutoFlush(bool bValue)
Definition NetConnection.h:1902
virtual ENGINE_API void InitBase(UNetDriver *InDriver, class FSocket *InSocket, const FURL &InURL, EConnectionState InState, int32 InMaxPacket=0, int32 InPacketOverhead=0)
Definition NetConnection.cpp:464
virtual ENGINE_API void DispatchPacket(FBitReader &Reader, int32 PacketId, bool &bOutSkipAck, bool &bOutHasBunchErrors)
Definition NetConnection.cpp:3496
TWeakPtr< StatelessConnectHandlerComponent > StatelessConnectComponent
Definition NetConnection.h:447
FActorChannelMap::TConstIterator ActorChannelConstIterator() const
Definition NetConnection.h:741
virtual void virtual InitRemoteConnection(UNetDriver *InDriver, class FSocket *InSocket, const FURL &InURL, const class FInternetAddr &InRemoteAddr, EConnectionState InState, int32 InMaxPacket=0, int32 InPacketOverhead=0) PURE_VIRTUAL(UNetConnection void InitLocalConnection(UNetDriver *InDriver, class FSocket *InSocket, const FURL &InURL, EConnectionState InState, int32 InMaxPacket=0, int32 InPacketOverhead=0) PURE_VIRTUAL(UNetConnection virtual ENGINE_API voi InitConnection)(UNetDriver *InDriver, EConnectionState InState, const FURL &InURL, int32 InConnectionSpeed=0, int32 InMaxPacket=0)
Definition NetConnection.h:1226
virtual TSharedPtr< const FInternetAddr > GetRemoteAddr()
Definition NetConnection.h:1129
void SetPackageVersionLicenseeUE(int32 InPackageVersionLicenseeUE)
Definition NetConnection.h:790
int32 OutAckPacketId
Definition NetConnection.h:636
FName GetClientWorldPackageName() const
Definition NetConnection.h:871
const FNetConnectionPacketLoss & GetOutLossPercentage() const
Definition NetConnection.h:600
ENGINE_API void SendClientEncryptionAck()
Definition NetConnection.cpp:866
UReplicationConnectionDriver * GetReplicationConnectionDriver()
Definition NetConnection.h:751
ENGINE_API UChildConnection * CreateChildWithNetPlayerIndex(int32 NetPlayerIndex)
Definition NetConnection.cpp:5225
int32 InPacketId
Definition NetConnection.h:634
static ENGINE_API void AddReferencedObjects(UObject *InThis, FReferenceCollector &Collector)
Definition NetConnection.cpp:1633
void SetForceInitialDirty(bool bValue)
Definition NetConnection.h:354
TObjectPtr< class UNetDriver > Driver
Definition NetConnection.h:297
virtual ENGINE_API bool IsNetReady() const
Definition NetConnection.cpp:2651
virtual ENGINE_API void AssertValid()
Definition NetConnection.cpp:1687
virtual ENGINE_API void FlushNet(bool bIgnoreSimulation=false)
Definition NetConnection.cpp:2338
virtual FString LowLevelGetRemoteAddress(bool bAppendPort=false) PURE_VIRTUAL(UNetConnection
Definition NetConnection.h:1029
void SetReplay(bool bValue)
Definition NetConnection.h:346
FOutBunch * LastOutBunch
Definition NetConnection.h:521
bool ContainsActorChannel(const TWeakObjectPtr< AActor > &Actor)
Definition NetConnection.h:731
FBitWriterMark LastStart
Definition NetConnection.h:517
TUniquePtr< PacketHandler > Handler
Definition NetConnection.h:444
ENGINE_API int32 SendRawBunch(FOutBunch &Bunch, bool InAllowMerge, const FNetTraceCollector *BunchCollector)
Definition NetConnection.cpp:4391
TSet< FNetworkGUID > & GetDestroyedStartupOrDormantActorGUIDs()
Definition NetConnection.h:846
FBitWriterMark LastEnd
Definition NetConnection.h:518
int32 GetTotalOutOfOrderPackets() const
Definition NetConnection.h:1529
int32 LagCount
Definition NetConnection.h:538
FNetTraceCollector * GetInTraceCollector() const
Definition NetConnection.h:2121
int32 InPackets
Definition NetConnection.h:563
void SetPackageVersionUE(FPackageFileVersion InPackageVersionUE)
Definition NetConnection.h:787
void Close(FNetCloseResult &&CloseReason)
Definition NetConnection.h:1145
int32 InTotalPacketsLost
Definition NetConnection.h:577
int32 GetTotalOutOfOrderPacketsRecovered() const
Definition NetConnection.h:1549
const UNetDriver * GetDriver() const
Definition NetConnection.h:1350
ENGINE_API bool GetNetPlayerIndex(UChildConnection *ChildConnection, int32 *OutNetPlayerIndex)
Definition NetConnection.cpp:5189
UE::Net::FNetConnectionFaultRecovery * GetFaultRecovery()
Definition NetConnection.h:1909
bool bNeedsByteSwapping
Definition NetConnection.h:451
virtual void LowLevelSend(void *Data, int32 CountBits, FOutPacketTraits &Traits) PURE_VIRTUAL(UNetConnection virtual ENGINE_API voi ValidateSendBuffer)()
Definition NetConnection.h:1049
FBitWriter SendBuffer
Definition NetConnection.h:630
EWriteBitsDataType
Definition NetConnection.h:408
int32 GetTotalOutOfOrderPacketsDuplicate() const
Definition NetConnection.h:1559
static class UNetConnection * GNetConnectionBeingCleanedUp
Definition NetConnection.h:985
virtual ENGINE_API void NotifyAnalyticsProvider()
Definition NetConnection.cpp:807
virtual ENGINE_API bool IsEncryptionEnabled() const
Definition NetConnection.cpp:915
FOnLowLevelSend LowLevelSendDel
Definition NetConnection.h:941
void PopLastStart()
Definition NetConnection.cpp:4375
float StatPeriod
Definition NetConnection.h:530
bool IsForceInitialDirty() const
Definition NetConnection.h:353
double FrameTime
Definition NetConnection.h:541
void StopTickingChannel(UChannel *Channel)
Definition NetConnection.h:1434
ENGINE_API UChildConnection * CreateChild(int32 *OutNetPlayerIndex)
Definition NetConnection.cpp:5208
bool AllowMerge
Definition NetConnection.h:519
FNetTraceCollector * GetOutTraceCollector() const
Definition NetConnection.h:2122
void SetPacketOSReceiveTime(const FPacketTimestamp &InOSReceiveTime, bool bInIsOSReceiveTimeLocal)
Definition NetConnection.h:1570
virtual ENGINE_API bool ClientHasInitializedLevel(const ULevel *TestLevel) const
Definition NetConnection.cpp:1726
double CumulativeTime
Definition NetConnection.h:544
void SetUnlimitedBunchSizeAllowed(bool bValue)
Definition NetConnection.h:366
void SetConnectionHandle(UE::Net::FConnectionHandle Handle)
Definition NetConnection.h:1974
virtual FString LowLevelDescribe() PURE_VIRTUAL(UNetConnection
Definition NetConnection.h:1032
bool bLastHasServerFrameTime
Definition NetConnection.h:643
void Close()
Definition NetConnection.h:1135
int32 InBytes
Definition NetConnection.h:559
int32 GetMaxSingleBunchSizeBits() const
Definition NetConnection.h:1343
int NumPacketIdBits
Definition NetConnection.h:389
virtual ENGINE_API ~UNetConnection()
DECLARE_MULTICAST_DELEGATE_ThreeParams(FOnConnectionOpened, UNetConnection *, APlayerController *, UNetConnection *)
uint32 GetOutTotalNotifiedPackets() const
Definition NetConnection.h:1629
int NumAckBits
Definition NetConnection.h:395
virtual int32 GetAddrPort(void)
Definition NetConnection.h:1088
bool GetAutoFlush() const
Definition NetConnection.h:1901
double AverageFrameTime
Definition NetConnection.h:547
float GetAverageJitterInMS() const
Definition NetConnection.h:553
int32 ActorChannelsNum() const
Definition NetConnection.h:736
double LagAcc
Definition NetConnection.h:536
void ResetDestructionInfos()
Definition NetConnection.h:830
void RemoveDestructionInfo(FActorDestructionInfo *DestructionInfo)
Definition NetConnection.h:814
int32 WriteBitsToSendBuffer(const uint8 *Bits, const int32 SizeInBits, const uint8 *ExtraBits=NULL, const int32 ExtraSizeInBits=0, EWriteBitsDataType DataType=EWriteBitsDataType::Unknown)
Definition NetConnection.cpp:4347
bool IsUnlimitedBunchSizeAllowed() const
Definition NetConnection.h:365
TOptional< FNetworkCongestionControl > NetworkCongestionControl
Definition NetConnection.h:1970
UActorChannel ** FindActorChannel(const TWeakObjectPtr< AActor > &Actor)
Definition NetConnection.h:726
void SendCloseReason(FNetCloseResult &&CloseReason)
Definition NetConnection.h:1925
ENGINE_API void RemoveChild(UChildConnection *ChildConnection)
Definition NetConnection.cpp:5245
ENGINE_API void EnableEncryption()
Definition NetConnection.cpp:897
UActorChannel * FindActorChannelRef(const TWeakObjectPtr< AActor > &Actor)
Definition NetConnection.h:721
virtual ENGINE_API TSharedPtr< FObjectReplicator > CreateReplicatorForNewActorChannel(UObject *Object)
Definition NetConnection.cpp:4384
void SetReplicationConnectionDriver(UReplicationConnectionDriver *NewReplicationConnectionDriver)
Definition NetConnection.h:756
void ReadInput(float DeltaSeconds)
Definition NetConnection.cpp:2678
void SlowAssertValid()
Definition NetConnection.h:1376
EResendAllDataState ResendAllDataState
Definition NetConnection.h:934
void AddActorChannel(AActor *Actor, UActorChannel *Channel)
Definition NetConnection.h:712
TNetAnalyticsDataPtr< FNetConnAnalyticsData > NetAnalyticsData
Definition NetConnection.h:627
int32 SendRawBunch(FOutBunch &Bunch, bool InAllowMerge)
Definition NetConnection.h:1340
int32 CountedFrames
Definition NetConnection.h:556
int64 GetFreeSendBufferBits()
Definition NetConnection.cpp:4362
TMap< FString, TArray< float > > & GetActorsStarvedByClassTimeMap()
Definition NetConnection.h:415
ENGINE_API UChannel * CreateChannelByName(const FName &ChName, EChannelCreateFlags CreateFlags, int32 ChannelIndex=INDEX_NONE)
Definition NetConnection.cpp:4548
FHistogram GetNetHistogram() const
Definition NetConnection.h:1438
UE::Net::FNetPing * GetNetPing()
Definition NetConnection.h:1914
int32 InPacketsPerSecond
Definition NetConnection.h:573
virtual ENGINE_API void InitSendBuffer()
Definition NetConnection.cpp:2031
bool GetPendingCloseDueToSocketSendFailure() const
Definition NetConnection.h:1654
ENGINE_API void GracefulClose(FNetResult &&CloseReason)
Definition NetConnection.cpp:1141
int32 InTotalBytes
Definition NetConnection.h:561
virtual ENGINE_API void FinishDestroy() override
Definition NetConnection.cpp:1623
int32 MaxPacket
Definition NetConnection.h:324
virtual ENGINE_API void InitSequence(int32 IncomingSequence, int32 OutgoingSequence)
Definition NetConnection.cpp:763
virtual void NotifyActorNetGUID(UActorChannel *Channel)
Definition NetConnection.h:1577
const FNetConnectionPacketLoss & GetInLossPercentage() const
Definition NetConnection.h:599
virtual ENGINE_API void ReceivedRawPacket(void *Data, int32 Count)
Definition NetConnection.cpp:2056
virtual ENGINE_API UWorld * GetWorld() const override
Definition NetConnection.cpp:1656
int32 OutTotalAcks
Definition NetConnection.h:579
void SetEngineVersion(const FEngineVersion &InEngineVersion)
Definition NetConnection.h:793
int32 InBytesPerSecond
Definition NetConnection.h:571
virtual ENGINE_API void HandleClientPlayer(class APlayerController *PC, class UNetConnection *NetConnection)
Definition NetConnection.cpp:5075
UNetDriver * GetDriver()
Definition NetConnection.h:1349
int32 GetTotalOutOfOrderPacketsLost() const
Definition NetConnection.h:1539
const TSet< FName > & GetClientMakingVisibleLevelNames() const
Definition NetConnection.h:885
FRPCDoSDetection * GetRPCDoS()
Definition NetConnection.h:1904
int32 InPacketsLost
Definition NetConnection.h:575
int32 InTotalPackets
Definition NetConnection.h:569
void ResetActorsStarvedByClassTimeMap()
Definition NetConnection.h:418
int32 GetNumTickingChannels() const
Definition NetConnection.h:1436
ENGINE_API UChildConnection * GetChildConnectionWithNetPlayerIndex(const int32 NetPlayerIndex)
Definition NetConnection.cpp:5175
FOutBunch LastOut
Definition NetConnection.h:522
virtual ENGINE_API void CleanUp()
Definition NetConnection.cpp:1364
virtual bool IsReplayReady() const
Definition NetConnection.h:351
UE_DEPRECATED(5.4, "ClientHasInitializedLevelFor is deprecated. Use ClientHasInitializedLevel and pass the actor's level (Actor->GetLevel()) instead.") ENGINE_API virtual bool ClientHasInitializedLevelFor(const AActor *TestActor) const
int32 MaxPacketHandlerBits
Definition NetConnection.h:401
void ResetGameWorldState()
Definition NetConnection.cpp:5417
void SetInternalAck(bool bValue)
Definition NetConnection.h:337
FName GetPlayerOnlinePlatformName() const
Definition NetConnection.h:1455
double GetConnectTime() const
Definition NetConnection.h:491
FOnConnectionOpened & GetOnConnectionOpened()
Definition NetConnection.h:962
void StartTickingChannel(UChannel *Channel)
Definition NetConnection.h:1431
ULevel * GetRepContextLevel() const
Definition NetConnection.h:1899
ENGINE_API bool IsPacketSequenceWindowFull(uint32 SafetyMargin=0U)
Definition NetConnection.cpp:2673
int32 GetInTotalHandlerPackets() const
Definition NetConnection.h:592
bool TimeSensitive
Definition NetConnection.h:520
int32 OutPacketId
Definition NetConnection.h:635
virtual ENGINE_API void InitHandler()
Definition NetConnection.cpp:694
uint32 bPendingDestroy
Definition NetConnection.h:440
Definition NetDriver.h:799
Definition Object.h:95
Definition CoreNet.h:191
Definition Player.h:18
Definition ReplicationDriver.h:116
Definition NetConnection.h:2097
virtual void InitRemoteConnection(UNetDriver *InDriver, class FSocket *InSocket, const FURL &InURL, const class FInternetAddr &InRemoteAddr, EConnectionState InState, int32 InMaxPacket=0, int32 InPacketOverhead=0) override
Definition NetConnection.h:2110
virtual TSharedPtr< const FInternetAddr > GetRemoteAddr() override
Definition NetConnection.h:2108
virtual void LowLevelSend(void *Data, int32 CountBits, FOutPacketTraits &Traits) override
Definition NetConnection.h:2101
virtual FString LowLevelGetRemoteAddress(bool bAppendPort=false) override
Definition NetConnection.h:2103
virtual void DestroyOwningActor() override
Definition NetConnection.h:2106
virtual void InitLocalConnection(UNetDriver *InDriver, class FSocket *InSocket, const FURL &InURL, EConnectionState InState, int32 InMaxPacket=0, int32 InPacketOverhead=0) override
Definition NetConnection.h:2111
virtual bool ClientHasInitializedLevel(const ULevel *TestLevel) const override
Definition NetConnection.h:2104
virtual FString LowLevelDescribe() override
Definition NetConnection.h:2113
Definition VoiceChannel.h:20
Definition World.h:918
GeometryCollection::Facades::FMuscleActivationData Data
Definition MuscleActivationConstraints.h:15
Definition NetConnection.h:116
Type
Definition NetConnection.h:118
@ LoggingIn
Definition NetConnection.h:120
@ Invalid
Definition NetConnection.h:119
@ CleanedUp
Definition NetConnection.h:123
@ Welcomed
Definition NetConnection.h:121
@ ReceivedJoin
Definition NetConnection.h:122
Definition NetConnection.h:67
ENGINE_API bool HasDisabledBandwidthThrottling()
Definition NetConnection.cpp:135
constexpr int32 NumBitsForJitterClockTimeInHeader
Definition NetConnection.h:69
Definition NetworkVersion.cpp:28
ENetUpgradeSource
Definition NetConnection.h:107
TNetResult< ENetCloseResult > FNetCloseResult
Definition NetCloseResult.h:425
Definition AdvancedWidgetsModule.cpp:13
@ false
Definition radaudio_common.h:23
Definition NetDriver.h:630
FNetworkGUID NetGUID
Definition NetDriver.h:640
Definition BitReader.h:25
Definition BitWriter.h:209
Definition BitWriter.h:22
Definition NetConnection.h:252
EChannelCloseReason CloseReason
Definition NetConnection.h:254
uint32 Id
Definition NetConnection.h:253
Definition CoreNet.h:739
Definition NetworkDelegates.h:130
Type
Definition EngineNetworkCustomVersion.h:51
Definition Guid.h:109
Definition Histogram.h:34
static constexpr UE_FORCEINLINE_HINT T DivideAndRoundUp(T Dividend, T Divisor)
Definition UnrealMathUtility.h:694
static UE_FORCEINLINE_HINT void * Memcpy(void *Dest, const void *Src, SIZE_T Count)
Definition UnrealMemory.h:160
Definition EngineNetAnalytics.h:14
Definition NetAnalyticsTypes.h:298
Definition NetAnalyticsTypes.h:219
Definition NetConnection.h:2034
FNetConnectionSettings(int32 InPacketLag)
Definition NetConnection.h:2046
void ApplyTo(UNetConnection *Connection)
Definition NetConnection.h:2052
int32 PacketLag
Definition NetConnection.h:2060
int32 PacketLoss
Definition NetConnection.h:2061
FNetConnectionSettings(UNetConnection *InConnection)
Definition NetConnection.h:2035
Definition UpdateLevelVisibilityLevelInfo.h:10
Definition NetAnalyticsTypes.h:178
Definition PacketTraits.h:21
Definition ObjectVersion.h:762
Definition NetDriver.h:455
Definition PacketView.h:135
Definition ResourceArray.h:31
Definition NetConnection.h:2068
FNetConnectionSettings OldSettings
Definition NetConnection.h:2089
~FScopedNetConnectionSettings()
Definition NetConnection.h:2078
TWeakObjectPtr< UNetConnection > Connection
Definition NetConnection.h:2088
bool ShouldApply
Definition NetConnection.h:2090
FScopedNetConnectionSettings(UNetConnection *InConnection, FNetConnectionSettings NewSettings, bool Apply=true)
Definition NetConnection.h:2069
Definition NetConnection.h:1998
FScopedRepContext(FScopedRepContext &&)=delete
FScopedRepContext(UNetConnection *InConnection, ULevel *InLevel)
Definition NetConnection.h:2002
FScopedRepContext & operator=(const FScopedRepContext &)=delete
FScopedRepContext(const FScopedRepContext &)=delete
FScopedRepContext & operator=(FScopedRepContext &&)=delete
~FScopedRepContext()
Definition NetConnection.h:2014
Definition EngineBaseTypes.h:799
Definition OnlineReplStructs.h:26
Definition UpdateLevelVisibilityLevelInfo.h:52
Definition NetConnection.h:264
uint32 Value
Definition NetConnection.h:265
uint32 IsSequence
Definition NetConnection.h:266
Definition NetConnection.h:260
int32 LastPacketId
Definition NetConnection.h:272
FChannelRecordEntryQueue ChannelRecord
Definition NetConnection.h:271
@ DefaultInitialSize
Definition NetConnection.h:261
FWrittenChannelsRecord(size_t InitialSize=DefaultInitialSize)
Definition NetConnection.h:275
TResizableCircularQueue< FChannelRecordEntry > FChannelRecordEntryQueue
Definition NetConnection.h:269
Definition ObjectPtr.h:488
Definition Optional.h:131
Definition PimplPtr.h:50
Definition WeakObjectPtrTemplates.h:415
Definition WeakObjectPtrTemplates.h:25
FORCEINLINE T * Get(bool bEvenIfPendingKill) const
Definition WeakObjectPtrTemplates.h:132
Definition NetResult.h:64
Definition NetDormantHolder.h:81
Definition NetResult.h:330