Exemple #1
0
            public override void Update(double totalTime, double frameTime)
            {
                base.Update(totalTime, frameTime);

                if (_pingCheckTime < Time.Ticks)
                {
                    _pingCheckTime = Time.Ticks + 2000;
                    _entry.DoPing();

                    switch (_entry.PingStatus)
                    {
                    case IPStatus.Success: _server_ping.Text = _entry.Ping == -1 ? "-" : _entry.Ping.ToString(); break;

                    case IPStatus.DestinationNetworkUnreachable:
                    case IPStatus.DestinationHostUnreachable:
                    case IPStatus.DestinationProtocolUnreachable:
                    case IPStatus.DestinationPortUnreachable:
                    case IPStatus.DestinationUnreachable: _server_ping.Text = "unreach."; break;

                    case IPStatus.TimedOut: _server_ping.Text = "time out"; break;

                    default: _server_ping.Text = $"unk. [{(int) _entry.PingStatus}]"; break;
                    }

                    _server_packet_loss.Text = $"{_entry.PacketLoss}%";
                }
            }