Microsoft.Protocols.TestSuites.Pccrr.PccrrClientAdapter.SendMsgBlk C# (CSharp) Method

SendMsgBlk() public method

Send message MSG_BLK.
public SendMsgBlk ( bool isTimerExpire, bool isSameSegment, DWHashAlgValues dwHashAlgoValues, uint index, bool isLastBLK ) : void
isTimerExpire bool The timer for SendMsgBlk from client will expire or not.
isSameSegment bool The message is for the segment that client request.
dwHashAlgoValues DWHashAlgValues The dwHashAlgo value.
index uint Block index
isLastBLK bool If it is true, the block is the last BLK.
return void
        public void SendMsgBlk(bool isTimerExpire, bool isSameSegment, DWHashAlgValues dwHashAlgoValues, uint index, bool isLastBLK)
        {
            PccrrBLKResponsePacket pccrrBLKResponsePacket;
            if (!isSameSegment && dwHashAlgoValues == DWHashAlgValues.V1)
            {
                this.sid = Encoding.UTF8.GetBytes(this.GetProperty("PCCRR.Protocol.ErrorSegmentId"));
                pccrrBLKResponsePacket = this.pccrrStackSer.CreateMsgBlkResponse(this.sid, new byte[] { }, this.cryptoAlgo, MsgType_Values.MSG_BLK, this.protoVer, isLastBLK);
            }
            else
            {
                if (dwHashAlgoValues == DWHashAlgValues.V3)
                {
                    this.sid = PccrrUtitlity.ToByteArray(this.GetProperty("PCCRR.Protocol.SHA512.SegmentId"));
                }
                else
                {
                    this.sid = PccrrUtitlity.ToByteArray(this.GetProperty("PCCRR.Protocol.SHA384.SegmentId"));
                }

                pccrrBLKResponsePacket = this.pccrrStackSer.CreateMsgBlkResponse(this.sid, new byte[] { }, this.cryptoAlgo, MsgType_Values.MSG_BLK, this.protoVer, isLastBLK);
            }

            MSG_BLK msgBLK = new MSG_BLK();
            msgBLK = pccrrBLKResponsePacket.MsgBLK;
            msgBLK.BlockIndex = index;

            if (!isLastBLK)
            {
                if (index == uint.MaxValue)
                {
                    throw new ArgumentOutOfRangeException("index");
                }
                else
                {
                    msgBLK.NextBlockIndex = index + 1;
                }
            }

            pccrrBLKResponsePacket.MsgBLK = msgBLK;

            try
            {
                this.pccrrStackSer.SendPacket(pccrrBLKResponsePacket);
            }
            catch (HttpListenerException ex)
            {
                if (ex.ErrorCode == 1229 && isTimerExpire)
                {
                    this.ReceivingTimeOut();
                }
            }
        }