MinPingSendWaitTimeMs
MinPingSendWaitTimeMs
#Overview
name: MinPingSendWaitTimeMs
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of MinPingSendWaitTimeMs is to control the minimum wait time between sending ping requests in the UDP ping system of Unreal Engine 5. This variable is used to prevent excessive network traffic by limiting the frequency of ping requests.
This setting variable is primarily used in the ICMP module of Unreal Engine, specifically within the UDP ping functionality. It’s part of the networking subsystem and is used for network diagnostics and performance measurement.
The value of this variable is set in two places:
- It’s initially set to the total milliseconds of FUdpPingWorker::SendWaitTime.
- It can be overridden by a value specified in the GEngineIni configuration file under the “Ping” section.
MinPingSendWaitTimeMs interacts with other variables such as:
- LastSendActivityTimeCycles: Used to calculate the time elapsed since the last ping was sent.
- NumSkippedPings: Keeps track of how many ping attempts were skipped due to the minimum wait time constraint.
Developers should be aware of the following when using this variable:
- It directly affects the rate at which ping requests are sent, which can impact network performance and diagnostics accuracy.
- The value can be configured in the engine’s INI file, allowing for easy adjustment without code changes.
- Setting this value too low might lead to excessive network traffic, while setting it too high might result in less accurate or less responsive ping measurements.
Best practices when using this variable include:
- Carefully consider the balance between ping frequency and network load when setting this value.
- Use the configuration file to adjust the value for different environments (e.g., development vs. production).
- Monitor the NumSkippedPings value to ensure the wait time isn’t causing too many skipped pings, which could affect the accuracy of network diagnostics.
- Consider the specific needs of your application when adjusting this value, as different types of games or applications may have different optimal ping frequencies.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:85, section: [Ping]
- INI Section:
Ping
- Raw value:
10.0
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Online/ICMP/Private/UDPPing.cpp:205
Scope (from outer to inner):
file
class class FUdpPingWorker : public FRunnable
Source code excerpt:
bool bCancelOperation;
double MinPingSendWaitTimeMs;
ISocketSubsystem* SocketSubsystem;
TArray<FIcmpTarget> Targets;
TMap<FProgressKey, FProgress> ProgressTable;
#Loc: <Workspace>/Engine/Source/Runtime/Online/ICMP/Private/UDPPing.cpp:281
Scope (from outer to inner):
file
function FUdpPingWorker::FUdpPingWorker
Source code excerpt:
, NumValidRepliesReceived(0)
, bCancelOperation(false)
, MinPingSendWaitTimeMs(0)
, SocketSubsystem(InSocketSub)
, Targets(InTargets)
, GotResultDelegate(InGotResultDelegate)
, CompletionDelegate(InCompletionDelegate)
{
}
#Loc: <Workspace>/Engine/Source/Runtime/Online/ICMP/Private/UDPPing.cpp:306
Scope (from outer to inner):
file
function bool FUdpPingWorker::Init
Source code excerpt:
bCancelOperation = false;
MinPingSendWaitTimeMs = FUdpPingWorker::SendWaitTime.GetTotalMilliseconds();
GConfig->GetDouble(TEXT("Ping"), TEXT("MinPingSendWaitTimeMs"), MinPingSendWaitTimeMs, GEngineIni);
return true;
}
uint32 FUdpPingWorker::Run()
{
#Loc: <Workspace>/Engine/Source/Runtime/Online/ICMP/Private/UDPPing.cpp:576
Scope (from outer to inner):
file
function bool FUdpPingWorker::SendPings
Source code excerpt:
const double DeltaMs = FPlatformTime::ToMilliseconds64(FPlatformTime::Cycles64() - LastSendActivityTimeCycles);
if (bSentLastPing && (DeltaMs < MinPingSendWaitTimeMs && NumSkippedPings >= 0))
{
// Skip sending pings for a bit (but continue receiving) to not spam traffic.
++NumSkippedPings;
continue;
}
if (NumSkippedPings > 0)
{
UE_LOG(LogPing, VeryVerbose, TEXT("SendPings: paused sending pings for %d iterations (for %.4f ms, configured wait time is %.4f ms); resuming sends"), NumSkippedPings, DeltaMs, MinPingSendWaitTimeMs);
}
// Send ping for current target in progress table.
// Only send a maximum of one ping request per iteration; checking for replies takes priority.
FProgress& Progress = ItSend->Value;