The RDP_NETCHAR_SYNC structure is sent in response to the RTT Measure Request (section 2.2.14.1.1) message or Bandwidth Measure Start (section 2.2.14.1.2) message and is used to short-circuit connect-time network characteristics detection in the case of an auto-reconnect (section 1.3.1.5 and 2.2.4).
Inheritance: NETWORK_DETECTION_RESPONSE
 /// <summary>
 /// Parse Network Detection Response Structures
 /// </summary>
 /// <param name="data"></param>
 /// <param name="currentIndex"></param>
 /// <returns>A specific Network Detection Response Structure</returns>
 public NETWORK_DETECTION_RESPONSE ParseNetworkDetectionResponse(byte[] data, ref int currentIndex, bool isSubHeader = false)
 {
     byte headerLength = (byte)data.Length;
     HeaderTypeId_Values headerTypeId = HeaderTypeId_Values.TYPE_ID_AUTODETECT_RESPONSE;
     if (isSubHeader)
     {
         headerLength += 2;
     }
     else
     {
         headerLength = ParseByte(data, ref currentIndex);
         headerTypeId = (HeaderTypeId_Values)ParseByte(data, ref currentIndex);
     }
     ushort sequenceNumber = ParseUInt16(data, ref currentIndex, false);
     AUTO_DETECT_RESPONSE_TYPE responseType = (AUTO_DETECT_RESPONSE_TYPE)ParseUInt16(data, ref currentIndex, false);
     if (responseType == AUTO_DETECT_RESPONSE_TYPE.RDP_RTT_RESPONSE)
     {
         RDP_RTT_RESPONSE rttResp = new RDP_RTT_RESPONSE();
         rttResp.headerLength = headerLength;
         rttResp.headerTypeId = headerTypeId;
         rttResp.sequenceNumber = sequenceNumber;
         rttResp.responseType = responseType;
         return rttResp;
     }
     else if (responseType == AUTO_DETECT_RESPONSE_TYPE.RDP_BW_RESULTS_AFTER_CONNECT || responseType == AUTO_DETECT_RESPONSE_TYPE.RDP_BW_RESULTS_DURING_CONNECT)
     {
         RDP_BW_RESULTS bwResults = new RDP_BW_RESULTS();
         bwResults.headerLength = headerLength;
         bwResults.headerTypeId = headerTypeId;
         bwResults.sequenceNumber = sequenceNumber;
         bwResults.responseType = responseType;
         bwResults.timeDelta = ParseUInt32(data, ref currentIndex, false);
         bwResults.byteCount = ParseUInt32(data, ref currentIndex, false);
         return bwResults;
     }
     else if (responseType == AUTO_DETECT_RESPONSE_TYPE.RDP_NETCHAR_SYNC)
     {
         RDP_NETCHAR_SYNC netCharSync = new RDP_NETCHAR_SYNC();
         netCharSync.headerLength = headerLength;
         netCharSync.headerTypeId = headerTypeId;
         netCharSync.sequenceNumber = sequenceNumber;
         netCharSync.responseType = responseType;
         netCharSync.bandwidth = ParseUInt32(data, ref currentIndex, false);
         netCharSync.rtt = ParseUInt32(data, ref currentIndex, false);
         return netCharSync;
     }
     else
     {
         throw new FormatException(ConstValue.ERROR_MESSAGE_ENUM_UNRECOGNIZED);
     }
 }
        public override NETWORK_DETECTION_RESPONSE Clone()
        {
            RDP_NETCHAR_SYNC netCharSync = new RDP_NETCHAR_SYNC();
            netCharSync.headerLength = this.headerLength;
            netCharSync.headerTypeId = this.headerTypeId;
            netCharSync.sequenceNumber = this.sequenceNumber;
            netCharSync.responseType = this.responseType;

            netCharSync.bandwidth = this.bandwidth;
            netCharSync.rtt = this.rtt;

            return netCharSync;
        }