Server.Network.ByteQueue.GetPacketID C# (CSharp) Méthode

GetPacketID() public méthode

public GetPacketID ( ) : byte
Résultat byte
		public byte GetPacketID()
		{
			if ( m_Size >= 1 )
				return m_Buffer[m_Head];

			return 0xFF;
		}

Usage Example

Exemple #1
0
        private bool HandleSeed(NetState ns, ByteQueue buffer)
        {
            if (buffer.GetPacketID() == 0xEF)
            {
                // new packet in client	6.0.5.0	replaces the traditional seed method with a	seed packet
                // 0xEF	= 239 =	multicast IP, so this should never appear in a normal seed.	 So	this is	backwards compatible with older	clients.
                ns.Seeded = true;
                return(true);
            }
            else if (buffer.Length >= 4)
            {
                byte[] m_Peek = new byte[4];

                buffer.Dequeue(m_Peek, 0, 4);

                int seed = (m_Peek[0] << 24) | (m_Peek[1] << 16) | (m_Peek[2] << 8) | m_Peek[3];

                if (seed == 0)
                {
                    Console.WriteLine("Login: {0}: Invalid client detected, disconnecting", ns);
                    ns.Dispose();
                    return(false);
                }

                ns.m_Seed = seed;
                ns.Seeded = true;
                return(true);
            }
            else
            {
                return(false);
            }
        }
All Usage Examples Of Server.Network.ByteQueue::GetPacketID