// // // // public void WriteMessage(byte[] message) { if (message == null) { throw new ArgumentNullException("message"); } m_WriteHeader.PayloadSize = message.Length; m_WriteHeader.CopyTo(m_WriteHeaderBuffer, 0); if (m_NetworkStream != null && message.Length != 0) { BufferOffsetSize[] buffers = new BufferOffsetSize[2]; buffers[0] = new BufferOffsetSize(m_WriteHeaderBuffer, 0, m_WriteHeaderBuffer.Length, false); buffers[1] = new BufferOffsetSize(message, 0, message.Length, false); m_NetworkStream.MultipleWrite(buffers); } else { Transport.Write(m_WriteHeaderBuffer, 0, m_WriteHeaderBuffer.Length); if (message.Length == 0) { return; } Transport.Write(message, 0, message.Length); } }
/// <devdoc> /// <para>Writes multiple buffers at once</para> /// </devdoc> internal void MultipleWrite(BufferOffsetSize[] buffers) { #if TRAVE for (int i = 0; i < buffers.Length; ++i) { GlobalLog.Dump(buffers[i].Buffer, buffers[i].Offset, buffers[i].Size); } #endif m_NetworkStream.MultipleWrite(buffers); }
/// <devdoc> /// <para>Writes multiple buffers at once</para> /// </devdoc> internal void MultipleWrite(BufferOffsetSize[] buffers) { m_NetworkStream.MultipleWrite(buffers); }