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.
Afficher le fichier Open project: RocHCI/legion-gaming Class Usage Examples

Méthodes publiques

Méthode 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 méthode

public BufferManager ( int totalBytes, int bufferSize ) : System
totalBytes int
bufferSize int
Résultat System

FreeBuffer() public méthode

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
Résultat void

InitBuffer() public méthode

Allocates buffer space used by the buffer pool
public InitBuffer ( ) : void
Résultat void

SetBuffer() public méthode

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