float Ping { get; set; }

robot_2Generated
code_blocksInput

Description

The Ping property of the Connection class represents the current network latency of the connection, measured in milliseconds. This value indicates the time it takes for a packet of data to travel from the client to the server and back. A lower ping value generally indicates a more responsive connection, which is crucial for real-time applications such as online gaming.

Usage

To access the Ping property, you need an instance of the Connection class. This property is read-only and provides the current ping value for the connection. It can be useful for monitoring network performance and diagnosing connectivity issues.

Example

// Example of accessing the Ping property
Connection connection = Connection.Find(someConnectionId);
float currentPing = connection.Ping;

// Output the current ping
// Note: Avoid using Console.WriteLine in Sandbox
Log.Info($"Current Ping: {currentPing} ms");