C# Class GamingInterface.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 bufffers to be easily reused and gaurds against fragmenting heap memory. The operations exposed on the BufferManager class are not thread safe.
Datei anzeigen Open project: RocHCI/legion-gaming Class Usage Examples

Public Methods

Method Description
BufferManager ( int totalBytes, int bufferSize ) : System
FreeBuffer ( SocketAsyncEventArgs args ) : void

Removes the buffer from a SocketAsyncEventArg object. This frees the buffer back to the buffer pool

InitBuffer ( ) : void

Allocates buffer space used by the buffer pool

SetBuffer ( SocketAsyncEventArgs args ) : bool

Assigns a buffer from the buffer pool to the specified SocketAsyncEventArgs object

Method Details

BufferManager() public method

public BufferManager ( int totalBytes, int bufferSize ) : System
totalBytes int
bufferSize int
return System

FreeBuffer() public method

Removes the buffer from a SocketAsyncEventArg object. This frees the buffer back to the buffer pool
public FreeBuffer ( SocketAsyncEventArgs args ) : void
args System.Net.Sockets.SocketAsyncEventArgs
return void

InitBuffer() public method

Allocates buffer space used by the buffer pool
public InitBuffer ( ) : void
return void

SetBuffer() public method

Assigns a buffer from the buffer pool to the specified SocketAsyncEventArgs object
public SetBuffer ( SocketAsyncEventArgs args ) : bool
args System.Net.Sockets.SocketAsyncEventArgs
return bool