Beispiel #1
0
 public NewIncomingConnectionPacket(ref RakDecoder decoder)
 {
     InternalAddress = new RakAddress[10];
     ServerAddress   = decoder.Address();
     for (int i = 0; i < 10; i++)
     {
         InternalAddress[i] = decoder.Address();
     }
     TimeSinceStart1 = decoder.Timestamp();
     TimeSinceStart2 = decoder.Timestamp();
 }
        public OpenConnectionRequestPacket(byte[] data)
        {
            RakDecoder decoder = new RakDecoder(data);

            Type = (PacketType)decoder.Byte();
            decoder.Magic();
            switch (Type)
            {
            case PacketType.OpenConnectionRequest1:
                ProtocolVersion = decoder.Byte();
                break;

            case PacketType.OpenConnectionRequest2:
                Address  = decoder.Address();
                MtuSize  = decoder.Short();
                ClientID = decoder.Long().Unsigned();
                break;

            default: Debug.Assert(false, "Unreachable."); break;
            }

            // Null padding
            decoder.Raw(data.Length - decoder.Pos);
        }