Microsoft.SqlServer.TDS.TDSStream._SendCurrentPacket C# (CSharp) Method

_SendCurrentPacket() private method

Serialize current packet into the underlying stream
private _SendCurrentPacket ( ) : void
return void
        private void _SendCurrentPacket()
        {
            // Check if we have a current packet
            if (OutgoingPacketHeader != null)
            {
                // store the OutgoingPacketHeader.Length, it could be updated in PreWriteCallBack (for Fuzz test)
                ushort outgoingPacketHeader_Length = OutgoingPacketHeader.Length;

                // PreWrite call before packet writing 
                if (PreWriteCallBack != null)
                {
                    // By calling PreWriteCallBack, 
                    // The length value in OutgoingPacketHeader (i.e. OutgoingPacketHeader.Length) could be fuzzed
                    // The actual written length of the packet (i.e. outgoingPacketHeader_Length) could be fuzzed
                    outgoingPacketHeader_Length = PreWriteCallBack(_outgoingPacket, 0, OutgoingPacketHeader.Length);
                }

                // Send the packet header along with packet body into the underlying stream
                InnerStream.Write(_outgoingPacket, 0, outgoingPacketHeader_Length);

                // Reset packet header
                OutgoingPacketHeader = null;

                // Reset packet
                _outgoingPacket = null;
            }
        }