forked from RevenantX/LiteNetLib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetStatistics.cs
More file actions
39 lines (36 loc) · 1.07 KB
/
NetStatistics.cs
File metadata and controls
39 lines (36 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
namespace LiteNetLib
{
public sealed class NetStatistics
{
public ulong PacketsSent;
public ulong PacketsReceived;
public ulong BytesSent;
public ulong BytesReceived;
public ulong PacketLoss;
public ulong PacketLossPercent
{
get { return PacketsSent == 0 ? 0 : PacketLoss * 100 / PacketsSent; }
}
public ulong SequencedPacketLoss;
public void Reset()
{
PacketsSent = 0;
PacketsReceived = 0;
BytesSent = 0;
BytesReceived = 0;
PacketLoss = 0;
}
public override string ToString()
{
return
string.Format(
"BytesReceived: {0}\nPacketsReceived: {1}\nBytesSent: {2}\nPacketsSent: {3}\nPacketLoss: {4}\nPacketLossPercent: {5}\n",
BytesReceived,
PacketsReceived,
BytesSent,
PacketsSent,
PacketLoss,
PacketLossPercent);
}
}
}