private void HandleConnectionResponse1(IPEndPoint address, OpenConnectionResponse1 response) { var connReq = new OpenConnectionRequest2 { Magic = RakNetConstants.Magic, ClientId = ClientId, Address = new RakAddress { Address = (UInt32)IPAddress.Parse("127.0.0.1").Address, Port = Socket.Port }, MTU = 1200 }; Send(address, connReq); }
private Packet DecodePacket(Byte id, BinaryReaderBE reader) { Packet packet = null; switch ((PacketId)id) { case PacketId.OpenConnectionRequest1: packet = new OpenConnectionRequest1(); break; case PacketId.OpenConnectionResponse1: packet = new OpenConnectionResponse1(); break; case PacketId.OpenConnectionRequest2: packet = new OpenConnectionRequest2(); break; case PacketId.OpenConnectionResponse2: packet = new OpenConnectionResponse2(); break; default: throw new InvalidDataException("Unrecognized packet ID"); } packet.Read(reader); return(packet); }