NetConnectionClassName
NetConnectionClassName
#Overview
name: NetConnectionClassName
The value of this variable can be defined or overridden in .ini config files. 5
.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 NetConnectionClassName is to specify the class name for network connections in Unreal Engine’s networking system. This setting variable is crucial for determining which class will be used to handle network connections in the game or application.
NetConnectionClassName is primarily used by the Engine’s networking subsystem, specifically within the NetDriver module. It’s also referenced in the DisplayClusterEditor plugin, suggesting its importance in networked display cluster setups.
The value of this variable is typically set in configuration files. As seen in the DisplayClusterEditorSettings.cpp, it can be set programmatically using GConfig->SetString(). In the NetDriver.h file, it’s declared as a Config property, meaning it can be set in the engine’s configuration files.
This variable interacts closely with the NetConnectionClass pointer in the NetDriver. The InitConnectionClass() function in NetDriver.cpp uses NetConnectionClassName to load the appropriate UNetConnection subclass.
Developers must be aware that:
- Changing this variable affects the entire networking behavior of the application.
- The specified class must be a valid subclass of UNetConnection.
- If the specified class fails to load, it will result in a logged error and potentially cause networking issues.
Best practices when using this variable include:
- Ensure the specified class exists and is correctly implemented before setting this variable.
- Use it consistently across all relevant configuration files and code to avoid conflicts.
- When customizing network behavior, create a custom NetConnection subclass and set NetConnectionClassName to use it.
- Always test thoroughly after changing this setting, as it can have wide-ranging effects on networking behavior.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:1642, section: [/Script/OnlineSubsystemUtils.IpNetDriver]
- INI Section:
/Script/OnlineSubsystemUtils.IpNetDriver
- Raw value:
"/Script/OnlineSubsystemUtils.IpConnection"
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseEngine.ini:1801, section: [/Script/Engine.DemoNetDriver]
- INI Section:
/Script/Engine.DemoNetDriver
- Raw value:
"/Script/Engine.DemoNetConnection"
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseEngine.ini:2253, section: [/Script/OnlineSubsystemSteam.SteamNetDriver]
- INI Section:
/Script/OnlineSubsystemSteam.SteamNetDriver
- Raw value:
"/Script/OnlineSubsystemSteam.SteamNetConnection"
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseEngine.ini:2256, section: [/Script/SteamSockets.SteamSocketsNetDriver]
- INI Section:
/Script/SteamSockets.SteamSocketsNetDriver
- Raw value:
"/Script/SteamSockets.SteamSocketsNetConnection"
- Is Array:
False
Location: <Workspace>/Engine/Plugins/Experimental/WebSocketNetworking/Config/BaseWebSocketNetDriver.ini:23, section: [/Script/WebSocketNetworking.WebSocketNetDriver]
- INI Section:
/Script/WebSocketNetworking.WebSocketNetDriver
- Raw value:
"/Script/WebSocketNetworking.WebSocketConnection"
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/nDisplay/Source/DisplayClusterEditor/Private/Settings/DisplayClusterEditorSettings.cpp:98
Scope (from outer to inner):
file
function void UDisplayClusterEditorSettings::PostEditChangeProperty
Source code excerpt:
GConfig->SetArray(TEXT("/Script/Engine.GameEngine"), TEXT("+NetDriverDefinitions"), NetDriverDefinitions, DefaultEnginePath);
GConfig->SetString(TEXT("/Script/DisplayClusterReplication.DisplayClusterNetDriver"), TEXT("NetConnectionClassName"), TEXT("DisplayClusterReplication.DisplayClusterNetConnection"), DefaultEnginePath);
}
else
{
GConfig->RemoveKey(TEXT("/Script/Engine.GameEngine"), TEXT("!NetDriverDefinitions"), DefaultEnginePath);
GConfig->RemoveKey(TEXT("/Script/Engine.GameEngine"), TEXT("+NetDriverDefinitions"), DefaultEnginePath);
GConfig->RemoveKey(TEXT("/Script/DisplayClusterReplication.DisplayClusterNetDriver"), TEXT("NetConnectionClassName"), DefaultEnginePath);
}
GConfig->Flush(false, DefaultEnginePath);
}
}
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/NetDriver.h:815
Scope (from outer to inner):
file
class class UNetDriver : public UObject, public FExec
Source code excerpt:
/** Used to specify the class to use for connections */
UPROPERTY(Config)
FString NetConnectionClassName;
UPROPERTY(Config)
FString ReplicationDriverClassName;
/** Used to specify the class to use for ReplicationBridge */
UPROPERTY(Config)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetDriver.cpp:1454
Scope (from outer to inner):
file
function bool UNetDriver::InitConnectionClass
Source code excerpt:
bool UNetDriver::InitConnectionClass(void)
{
if (NetConnectionClass == NULL && NetConnectionClassName != TEXT(""))
{
NetConnectionClass = LoadClass<UNetConnection>(NULL,*NetConnectionClassName,NULL,LOAD_None,NULL);
if (NetConnectionClass == NULL)
{
UE_LOG(LogNet, Error,TEXT("Failed to load class '%s'"),*NetConnectionClassName);
}
}
return NetConnectionClass != NULL;
}
bool UNetDriver::InitReplicationDriverClass()