BeaconConnectionTimeout
BeaconConnectionTimeout
#Overview
name: BeaconConnectionTimeout
The value of this variable can be defined or overridden in .ini config files. 2
.ini config files referencing this setting variable.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of BeaconConnectionTimeout is to set the maximum time a beacon will wait for network packets after establishing a connection before considering the connection timed out. This variable is crucial for managing network connections in Unreal Engine’s online subsystem.
BeaconConnectionTimeout is primarily used by the OnlineSubsystemUtils plugin, specifically within the beacon system. The beacon system is a part of Unreal Engine’s networking infrastructure used for various online functionalities.
The value of this variable is typically set in the configuration files (as indicated by the UPROPERTY(Config) decorator in the AOnlineBeacon class definition). It can be adjusted in the project settings or through config files.
This variable interacts closely with the NetDriver’s ConnectionTimeout property. It’s used to set the ConnectionTimeout for both AOnlineBeaconClient and AOnlineBeaconHost classes. It also works in conjunction with BeaconConnectionInitialTimeout, which sets the initial connection timeout.
Developers must be aware that this timeout affects how long the beacon system will wait for a response after a connection is established. Setting it too low might result in premature disconnections, while setting it too high could lead to resources being tied up unnecessarily.
Best practices when using this variable include:
- Adjusting it based on your game’s specific networking requirements and expected latencies.
- Testing thoroughly with various network conditions to ensure it’s set appropriately.
- Considering different values for different platforms or connection types if necessary.
- Monitoring and logging connection timeouts to identify potential issues in your game’s networking.
- Balancing between responsiveness (detecting disconnections quickly) and tolerance for network instability.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:2383, section: [/Script/OnlineSubsystemUtils.OnlineBeacon]
- INI Section:
/Script/OnlineSubsystemUtils.OnlineBeacon
- Raw value:
45.0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseEngine.ini:2400, section: [/Script/Lobby.LobbyBeaconClient]
- INI Section:
/Script/Lobby.LobbyBeaconClient
- Raw value:
45.0
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/OnlineBeaconClient.cpp:195
Scope (from outer to inner):
file
function bool AOnlineBeaconClient::InitClient
Source code excerpt:
NetDriver->Notify = this;
NetDriver->InitialConnectTimeout = BeaconConnectionInitialTimeout;
NetDriver->ConnectionTimeout = BeaconConnectionTimeout;
if (!bSentHandshake)
{
SendInitialJoin();
}
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/OnlineBeaconHost.cpp:109
Scope (from outer to inner):
file
function bool AOnlineBeaconHost::InitHost
Source code excerpt:
NetDriver->Notify = this;
NetDriver->InitialConnectTimeout = BeaconConnectionInitialTimeout;
NetDriver->ConnectionTimeout = BeaconConnectionTimeout;
return true;
}
else
{
// error initializing the network stack...
UE_LOG(LogBeacon, Log, TEXT("%s: AOnlineBeaconHost::InitHost failed"), *GetName());
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Public/OnlineBeacon.h:103
Scope (from outer to inner):
file
class class AOnlineBeacon : public AActor, public FNetworkNotify
Source code excerpt:
/** Time beacon will wait for packets after establishing a connection before giving up */
UPROPERTY(Config)
float BeaconConnectionTimeout;
/** Net driver routing network traffic */
UPROPERTY()
TObjectPtr<UNetDriver> NetDriver;
/** State of beacon */