Esempio n. 1
0
        private UInt16 CalcTCPCRC()
        {
            UInt16 crc;

            byte[] tempHeader = new byte[32 + TCP_DataLength + optionsLength];
            for (int b = 0; b < 8; b++)
            {
                tempHeader[b] = mRawData[26 + b];
            }
            tempHeader[9]  = 6;
            tempHeader[10] = (byte)(this.TCP_Length >> 8);
            tempHeader[11] = (byte)(this.TCP_Length & 0xFF);
            for (int b = 0; b < 20 + optionsLength; b++)
            {
                tempHeader[12 + b] = mRawData[this.dataOffset + b];
            }
            for (int b = 0; b < this.TCP_DataLength; b++)
            {
                tempHeader[32 + optionsLength + b] = mRawData[this.tcpDataOffset + b];
            }

            crc = IPPacket.CalcOcCRC(tempHeader, 0, tempHeader.Length);

            return(crc);
        }