Пример #1
0
        internal void OnPacket(UdpStream buffer)
        {
            // track stats
            stats.PacketReceived((uint)buffer.Length >> 3);
            socket.Stats.PacketReceived((uint)buffer.Length >> 3);

            // set recv time of for last packet
            recvTime = socket.GetCurrentTime();

            if ((buffer.Data[0] & 1) == 1)
            {
                OnObjectReceived(buffer);
            }
            else
            {
                OnCommandReceived(buffer);
            }
        }
Пример #2
0
        internal void OnPacket(UdpStream buffer)
        {
            // track stats
            stats.PacketReceived((uint)buffer.Length >> 3);
            socket.Statistics.PacketReceived((uint)buffer.Length >> 3);

            // set recv time of for last packet
            recvTime = socket.GetCurrentTime();

            //需要转顺序.
            int firtInts = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(buffer.Data, 0));

            //if ((buffer.Data[0] & 1) == 1)
            if ((firtInts & 1) == 1)
            {
                OnObjectReceived(buffer);
            }
            else
            {
                OnCommandReceived(buffer);
            }
        }