/// <devdoc> /// <para> /// Starts off an async Write of an array of buffers. /// </para> /// </devdoc> internal virtual IAsyncResult BeginMultipleWrite( BufferOffsetSize[] buffers, AsyncCallback callback, Object state) { #if DEBUG GlobalLog.ThreadContract(ThreadKinds.Unknown, "NetworkStream#" + ValidationHelper.HashString(this) + "::BeginMultipleWrite"); using (GlobalLog.SetThreadKind(ThreadKinds.Async)) { #endif // // parameter validation // if (buffers == null) { throw new ArgumentNullException("buffers"); } Socket chkStreamSocket = m_StreamSocket; if (chkStreamSocket == null) { throw new IOException(SR.GetString(SR.net_io_writefailure, SR.GetString(SR.net_io_connectionclosed))); } try { // // call BeginMultipleSend on the Socket. // IAsyncResult asyncResult = chkStreamSocket.BeginMultipleSend( buffers, SocketFlags.None, callback, state); return(asyncResult); } catch (Exception exception) { if (exception is ThreadAbortException || exception is StackOverflowException || exception is OutOfMemoryException) { throw; } // // some sort of error occured on the socket call, // set the SocketException as InnerException and throw // throw new IOException(SR.GetString(SR.net_io_writefailure, exception.Message), exception); } #if DEBUG } #endif }
/// <devdoc> /// <para> /// Starts off an async Write of an array of buffers. /// </para> /// </devdoc> internal virtual IAsyncResult BeginMultipleWrite( BufferOffsetSize[] buffers, AsyncCallback callback, Object state) { // // parameter validation // if (buffers == null) { throw new ArgumentNullException("buffers"); } Socket chkStreamSocket = m_StreamSocket; if (chkStreamSocket == null) { throw new IOException(SR.GetString(SR.net_io_writefailure)); } try { buffers = ConcatenateBuffersOnWin9x(buffers); // // call BeginMultipleSend on the Socket. // IAsyncResult asyncResult = chkStreamSocket.BeginMultipleSend( buffers, SocketFlags.None, callback, state); return(asyncResult); } catch (Exception exception) { // // some sort of error occured on the socket call, // set the SocketException as InnerException and throw // throw new IOException(SR.GetString(SR.net_io_writefailure), exception); } }