public void Loop() { Server.AcceptConnection(); var list = Authentication.Connections; for (var i = 0; i < list.Count; i++) { list[i].ReceiveData(); if (Environment.TickCount >= pingTick + PingTime) { pingTick = Environment.TickCount; ping.Send(list[i], false); } if (!list[i].Connected) { Disconnected.Add(list[i]); } } // Remove disconnected users. if (Disconnected.Count > 0) { for (var i = 0; i < Disconnected.Count; i++) { Authentication.Remove(Disconnected[i]); Global.WriteLog($"Connection Removed {Disconnected[i].IpAddress.Ip}", "Black"); } Disconnected.Clear(); } }
public void SendPing() { if (Environment.TickCount >= pingTick) { if (Connected) { ping.Send(this); } pingTick = Environment.TickCount + Constants.PingTime; } }
public void Process(byte[] buffer, IConnection connection) { var msg = new SpPing(); msg.Send(connection); }