C# Класс BF2Statistics.Net.BufferManager

This class creates a single large buffer which can be divided up and assigned to SocketAsyncEventArgs objects for use with each socket I/O operation. This enables buffers to be easily reused and guards against fragmenting heap memory.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
BytesToAllocPerEventArg int

Защищенные свойства (Protected)

Свойство Тип Описание
Buffer byte[]
FreeBufferSpace ConcurrentStack

Открытые методы

Метод Описание
AssignBuffer ( SocketAsyncEventArgs args ) : bool

Assigns a buffer space from the buffer block to the specified SocketAsyncEventArgs object.

BufferManager ( int NumEventArgs, int BytesToAllocPerEventArg ) : System

Creates a new instance of BufferManager

Dispose ( ) : void

Releases all bytes held by this buffer

ReleaseBuffer ( SocketAsyncEventArgs args ) : void

Releases Buffer space assigned to a token so that it can be assingned to a new SAEA

Приватные методы

Метод Описание
CheckDisposed ( ) : void

If Dispose() has been called on this object, an ObjectDisposedException will be thrown here

Описание методов

AssignBuffer() публичный Метод

Assigns a buffer space from the buffer block to the specified SocketAsyncEventArgs object.
public AssignBuffer ( SocketAsyncEventArgs args ) : bool
args System.Net.Sockets.SocketAsyncEventArgs The SocketEventArgs object to assign a buffer space to
Результат bool

BufferManager() публичный Метод

Creates a new instance of BufferManager
public BufferManager ( int NumEventArgs, int BytesToAllocPerEventArg ) : System
NumEventArgs int Specifies the maximum number of SocketAsyncEventArgs objects that will be assigned buffer space at once
BytesToAllocPerEventArg int Specifies the number of bytes each SocketAsyncEventArgs object will be allocated from the buffer
Результат System

Dispose() публичный Метод

Releases all bytes held by this buffer
public Dispose ( ) : void
Результат void

ReleaseBuffer() публичный Метод

Releases Buffer space assigned to a token so that it can be assingned to a new SAEA
public ReleaseBuffer ( SocketAsyncEventArgs args ) : void
args System.Net.Sockets.SocketAsyncEventArgs The SocketEventArgs object that we are releasing buffer space from
Результат void

Описание свойств

Buffer защищенное свойство

Our buffer object
protected byte[] Buffer
Результат byte[]

BytesToAllocPerEventArg публичное свойство

The number of bytes each SocketAsyncEventArgs object gets allocated inside the Buffer for all IO operations
public int BytesToAllocPerEventArg
Результат int

FreeBufferSpace защищенное свойство

Contains free buffer space, which can be assigned to new SAEA
protected ConcurrentStack FreeBufferSpace
Результат ConcurrentStack