GetBuffers() private method

private GetBuffers ( ) : System.Net.BufferOffsetSize[]
return System.Net.BufferOffsetSize[]
 internal void Write(ScatterGatherBuffers writeBuffer)
 {
     BufferOffsetSize[] buffers = writeBuffer.GetBuffers();
     if (buffers != null)
     {
         base.MultipleWrite(buffers);
     }
 }
 //     This method is called by ConnectStream, only when resubmitting
 //     We have sent the headers already in HttpWebRequest.EndSubmitRequest()
 //     which calls ConnectStream.WriteHeaders() which calls to HttpWebRequest.EndWriteHeaders()
 //     which calls ConnectStream.ResubmitWrite() which calls in here
 internal void Write(ScatterGatherBuffers writeBuffer) {
     GlobalLog.Enter("Connection#" + ValidationHelper.HashString(this) + "::Write(ScatterGatherBuffers) networkstream#" + ValidationHelper.HashString(NetworkStream));
     //
     // parameter validation
     //
     GlobalLog.Assert(writeBuffer != null, "Connection#{0}::Write(ScatterGatherBuffers)|writeBuffer == null", ValidationHelper.HashString(this));
     //
     // set up array for MultipleWrite call
     // note that GetBuffers returns null if we never wrote to it.
     //
     BufferOffsetSize[] buffers = writeBuffer.GetBuffers();
     if (buffers!=null) {
         //
         // This will block writing the buffers out.
         //
         MultipleWrite(buffers);
     }
     GlobalLog.Leave("Connection#" + ValidationHelper.HashString(this) + "::Write(ScatterGatherBuffers) this:" + ValidationHelper.HashString(this) + " writeBuffer.Size:" + writeBuffer.Length.ToString());
 }
Example #3
0
        //
        // this API is called by ConnectStream, only when resubmitting
        // so we sent the headers already in HttpWebRequest.EndSubmitRequest()
        // which calls ConnectStream.WriteHeaders()
        // only after it queues async call to HttpWebRequest.EndWriteHeaders()
        // which calls ConnectStream.ResubmitWrite()
        // which calls in here
        //
        internal void Write(ScatterGatherBuffers writeBuffer) {
            //
            // parameter validation
            //
            GlobalLog.Assert(
                writeBuffer!=null,
                "writeBuffer==null",
                "Connection.Write(ScatterGatherBuffers) - failed internal parameter validation" );

            GlobalLog.Enter("Connection#" + ValidationHelper.HashString(this) + "::Write(ScatterGatherBuffers) cnt#" + ValidationHelper.HashString(this) + "trns#" + ValidationHelper.HashString(Transport));


            NetworkStream chkTransport = Transport;
            if (chkTransport==null) {
                Exception exception = new IOException(SR.GetString(SR.net_io_writefailure));
                GlobalLog.LeaveException("Connection#" + ValidationHelper.HashString(this) + "::Write(ScatterGatherBuffers)", exception);
                throw exception;
            }

            try {
                //
                // set up array for MultipleWrite call
                // note that GetBuffers returns null if we never wrote to it.
                //
                BufferOffsetSize[] buffers = writeBuffer.GetBuffers();
                if (buffers!=null) {
                    //
                    // when buffering this write will happend on a worker thread, so for async
                    // operating apps, this will not block
                    //
                    IAsyncResult asyncResult = chkTransport.BeginMultipleWrite(buffers, null, null);
                    chkTransport.EndMultipleWrite(asyncResult);
                }
            }
            catch (Exception exception) {
                m_Error = WebExceptionStatus.SendFailure;
                GlobalLog.LeaveException("Connection#" + ValidationHelper.HashString(this) + "::Write(ScatterGatherBuffers)", exception);
                throw;
            }

            GlobalLog.Leave("Connection#" + ValidationHelper.HashString(this) + "::Write(ScatterGatherBuffers) this:" + ValidationHelper.HashString(this) + " writeBuffer.Size:" + writeBuffer.Length.ToString());
        }