net.IpConnectionDisableResolution
net.IpConnectionDisableResolution
#Overview
name: net.IpConnectionDisableResolution
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If enabled, any future ip connections will not use resolution methods.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of net.IpConnectionDisableResolution is to control the address resolution behavior for IP connections in Unreal Engine’s networking system. Specifically, it is used to disable address resolution methods for future IP connections when enabled.
This setting variable is primarily used in the OnlineSubsystemUtils module, which is part of Unreal Engine’s networking and online subsystem. It directly affects the behavior of the UIpConnection class, which handles IP-based network connections.
The value of this variable is set through a console variable (CVar) named CVarNetIpConnectionDisableResolution. It is defined with a default value of 0 (disabled) and can be changed at runtime using console commands or through code.
The associated variable CVarNetIpConnectionDisableResolution interacts directly with net.IpConnectionDisableResolution. It is an instance of TAutoConsoleVariable
Developers must be aware that enabling this variable will prevent future IP connections from using address resolution methods. This can affect how the game establishes network connections, potentially impacting multiplayer functionality or other network-dependent features.
Best practices when using this variable include:
- Only enable it when specifically needed, as it can affect network connectivity.
- Test thoroughly after enabling to ensure network functionality is not adversely affected.
- Consider providing user-facing options to toggle this setting if it’s meant to be configurable.
- Use CVarNetIpConnectionDisableResolution.GetValueOnAnyThread() to read the value safely from any thread.
Regarding the associated variable CVarNetIpConnectionDisableResolution:
- It is a TAutoConsoleVariable that provides thread-safe access to the net.IpConnectionDisableResolution setting.
- It is used in the UIpConnection constructor to automatically disable address resolution if the CVar is set.
- When working with this variable, always use the GetValueOnAnyThread() method to retrieve its value, especially in multi-threaded contexts.
- Changes to this variable will affect newly created IP connections but not existing ones.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/IpConnection.cpp:41
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarNetIpConnectionDisableResolution(
TEXT("net.IpConnectionDisableResolution"),
0,
TEXT("If enabled, any future ip connections will not use resolution methods."),
ECVF_Default | ECVF_Cheat);
namespace UE::Net::Private
#Associated Variable and Callsites
This variable is associated with another variable named CVarNetIpConnectionDisableResolution
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/IpConnection.cpp:40
Scope: file
Source code excerpt:
TEXT("If true, the IpConnection will call the socket's SendTo function in a task graph task so that it can run off the game thread."));
TAutoConsoleVariable<int32> CVarNetIpConnectionDisableResolution(
TEXT("net.IpConnectionDisableResolution"),
0,
TEXT("If enabled, any future ip connections will not use resolution methods."),
ECVF_Default | ECVF_Cheat);
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemUtils/Source/OnlineSubsystemUtils/Private/IpConnection.cpp:105
Scope (from outer to inner):
file
function UIpConnection::UIpConnection
Source code excerpt:
{
// Auto add address resolution disable flags if the cvar is set.
if (!!CVarNetIpConnectionDisableResolution.GetValueOnAnyThread())
{
DisableAddressResolution();
}
}
void UIpConnection::InitBase(UNetDriver* InDriver, class FSocket* InSocket, const FURL& InURL, EConnectionState InState, int32 InMaxPacket, int32 InPacketOverhead)