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
파일 보기 프로젝트 열기: BF2Statistics/ControlCenter 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
BytesToAllocPerEventArg int

보호된 프로퍼티들

프로퍼티 타입 설명
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