Files
sbox-public/engine/Sandbox.Engine/Systems/Networking/System/ConnectionStats.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

55 lines
1.4 KiB
C#

namespace Sandbox.Network;
public struct ConnectionStats
{
/// <summary>
/// Current ping for this connection.
/// </summary>
public int Ping { get; set; }
/// <summary>
/// How many packets per second we're sending to this connection.
/// </summary>
public float OutPacketsPerSecond { get; set; }
/// <summary>
/// How many bytes per second we're sending to this connection.
/// </summary>
public float OutBytesPerSecond { get; set; }
/// <summary>
/// How many packets per second we're receiving from this connection.
/// </summary>
public float InPacketsPerSecond { get; set; }
/// <summary>
/// How many bytes per second we're receiving from this connection.
/// </summary>
public float InBytesPerSecond { get; set; }
/// <summary>
/// Estimate rate that we believe we can send data to this connection.
/// </summary>
public int SendRateBytesPerSecond { get; set; }
/// <summary>
/// From 0 to 1 how good is our connection to this?
/// </summary>
public float ConnectionQuality { get; set; }
private string Name { get; set; }
internal ConnectionStats( string name )
{
Name = name;
}
public override string ToString()
{
if ( string.IsNullOrEmpty( Name ) )
return $"ConnectionStats( OutBps: {OutBytesPerSecond}, InBps: {InBytesPerSecond}, Quality: {ConnectionQuality}";
else
return $"ConnectionStats( {Name}, OutBps: {OutBytesPerSecond}, InBps: {InBytesPerSecond}, Quality: {ConnectionQuality}";
}
}