public static void ReadKeepAlive(Client client, PacketReader reader) { KeepAlivePacket ka = new KeepAlivePacket(); ka.Read(reader); if (!reader.Failed) Client.HandlePacketKeepAlive(client, ka); }
private void OnKeepAlive(KeepAlivePacket p) { if (KeepAlive != null) KeepAlive.Invoke(this, new PacketEventArgs<KeepAlivePacket>(p)); }
public static void HandlePacketKeepAlive(Client client, KeepAlivePacket packet) { client.LastClientResponse = DateTime.Now; if (client.LastKeepAliveId > 0 && packet.KeepAliveID == client.LastKeepAliveId) { client.Ping = (int)Math.Round((DateTime.Now - client.KeepAliveStart).TotalMilliseconds, MidpointRounding.AwayFromZero); } }
public static void HandlePacketKeepAlive(TestClient client, KeepAlivePacket ka) { client.SendPacket(new KeepAlivePacket()); }