Example #1
0
 private static bool ReceivedInTheRightOrder(Message info, NetworkUpdateTracker socket)
 {
     return(socket.LastMessageTime <= info.Time
            ||
            (
                socket.LastMessageTime > 990 &&
                info.Time < 10
            ));
 }
Example #2
0
        private NetworkUpdateTracker GetSourceSocket(string ip, Message info)
        {
            NetworkUpdateTracker socket = null;

            for (int i = 0; i < Sockets.Count; i++)
            {
                if (Sockets[i].IP == ip)
                {
                    socket = Sockets[i];
                    break;
                }
            }

            if (socket == null)
            {
                socket = new NetworkUpdateTracker(ip, info.Time, 0);

                Sockets.Add(socket);
                PlayerConnected(ip, info);
                serverIp = ServerIpFinder.FindIp(Sockets.Select(f => f.IP), UdpWrapper.myIp);
            }

            return(socket);
        }