예제 #1
0
        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();
            }
        }
예제 #2
0
        public void SendPing()
        {
            if (Environment.TickCount >= pingTick)
            {
                if (Connected)
                {
                    ping.Send(this);
                }

                pingTick = Environment.TickCount + Constants.PingTime;
            }
        }
예제 #3
0
        public void Process(byte[] buffer, IConnection connection)
        {
            var msg = new SpPing();

            msg.Send(connection);
        }