コード例 #1
0
ファイル: CitpPacketTester.cs プロジェクト: Farrser/ACN
        /// <summary>
        /// Sends and receives a Peer Information packet.
        /// Performs some basic asserts on the header.
        /// </summary>
        /// <param name="citpMessage">The citp message.</param>
        /// <returns>The read packet.</returns>
        public static CitpPacket SendAndReceivePeerInformationPacket(CitpPInfHeader citpMessage)
        {
            CitpPInfHeader received = SendAndReceivePacket(citpMessage) as CitpPInfHeader;

            Assert.AreEqual(received.LayerContentType, citpMessage.LayerContentType);
            return(received);
        }
コード例 #2
0
        private static CitpPacket BuildPInf(CitpRecieveData data)
        {
            CitpPInfHeader header = new CitpPInfHeader();

            header.ReadData(data.GetReader());

            switch (header.LayerContentType)
            {
            case CitpPInfPeerLocation.PacketType:
                return(new CitpPInfPeerLocation(data.GetReader()));

            case CitpPInfPeerName.PacketType:
                return(new CitpPInfPeerName(data.GetReader()));
            }

            return(null);
        }