GetBuffer() public method

public GetBuffer ( ) : RioBufferSegment
return RioBufferSegment
Beispiel #1
0
        public unsafe RioBufferSegment Send(byte[] buffer, IPEndPoint remoteAdress)
        {
            Debug.Assert(inUse);
            var currentSegment = SendBufferPool.GetBuffer();

            fixed(byte *p = &buffer[0])
            {
                Unsafe.CopyBlock(currentSegment.dataPointer, p, (uint)buffer.Length);
            }

            currentSegment.SegmentPointer->Length = buffer.Length;
            SendAndDispose(currentSegment, remoteAdress, RIO_SEND_FLAGS.NONE);
            return(currentSegment);
        }
Beispiel #2
0
        public unsafe RioBufferSegment PreAllocateWrite(byte[] buffer)
        {
            var currentSegment = SendBufferPool.GetBuffer();

            currentSegment.Write(buffer);
            return(currentSegment);
        }
Beispiel #3
0
        public unsafe RioBufferSegment PreAllocateWrite(byte[] buffer)
        {
            var currentSegment = SendBufferPool.GetBuffer();

            fixed(byte *p = &buffer[0])
            {
                Unsafe.CopyBlock(currentSegment.RawPointer, p, (uint)buffer.Length);
            }

            currentSegment.SegmentPointer->Length = buffer.Length;
            return(currentSegment);
        }
Beispiel #4
0
        public unsafe void WriteFixed(byte[] buffer)
        {
            var currentSegment = SendBufferPool.GetBuffer();

            fixed(byte *p = &buffer[0])
            {
                Buffer.MemoryCopy(p, currentSegment.RawPointer, currentSegment.TotalLength, buffer.Length);
            }

            currentSegment.SegmentPointer->Length = buffer.Length;
            SendInternal(currentSegment, RIO_SEND_FLAGS.NONE);
        }
Beispiel #5
0
        public unsafe RioBufferSegment PreAllocateWrite(byte[] buffer)
        {
            var currentSegment = SendBufferPool.GetBuffer();

            fixed(byte *p = &buffer[0])
            {
                Buffer.MemoryCopy(p, currentSegment.RawPointer, currentSegment.TotalLength, buffer.Length);
            }

            currentSegment.SegmentPointer->Length = buffer.Length;
            currentSegment.AutoFree = false;
            return(currentSegment);
        }
Beispiel #6
0
        public unsafe RioBufferSegment WriteFixed(byte[] buffer)
        {
            var currentSegment = SendBufferPool.GetBuffer();

            fixed(byte *p = &buffer[0])
            {
                Unsafe.CopyBlock(currentSegment.RawPointer, p, (uint)buffer.Length);
            }

            currentSegment.SegmentPointer->Length = buffer.Length;
            SendInternal(currentSegment, RIO_SEND_FLAGS.NONE);
            currentSegment.DisposeWhenComplete();
            return(currentSegment);
        }