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); }
public unsafe RioBufferSegment PreAllocateWrite(byte[] buffer) { var currentSegment = SendBufferPool.GetBuffer(); currentSegment.Write(buffer); return(currentSegment); }
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); }
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); }
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); }
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); }