コード例 #1
0
        //
        //
        //
        //
        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);
            }
        }
コード例 #2
0
ファイル: _PooledStream.cs プロジェクト: dox0/DotNet471RS3
        /// <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);
        }
コード例 #3
0
 /// <devdoc>
 ///    <para>Writes multiple buffers at once</para>
 /// </devdoc>
 internal void MultipleWrite(BufferOffsetSize[] buffers)
 {
     m_NetworkStream.MultipleWrite(buffers);
 }