C# 클래스 BF2Statistics.Gamespy.Net.GamespyTcpSocket

This class represents a high performance Async Tcp Socket wrapper that is used to act as a base for all Gamespy protocol Tcp connections.
상속: IDisposable
파일 보기 프로젝트 열기: BF2Statistics/ControlCenter 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
BufferManager BF2Statistics.Net.BufferManager
BufferSizePerEventArg int
ConcurrentAcceptPoolSize int
ConnectionEnforceMode EnforceMode
FullErrorMessage string
Listener Socket
MaxConnectionsEnforcer System.Threading.SemaphoreSlim
MaxNumConnections int
SocketAcceptPool BF2Statistics.Net.SocketAsyncEventArgsPool
SocketReadWritePool BF2Statistics.Net.SocketAsyncEventArgsPool
WaitTimeout int

공개 메소드들

메소드 설명
Dispose ( ) : void

Releases all Objects held by this socket. Will also shutdown the socket if its still running

GamespyTcpSocket ( int Port, int MaxConnections ) : System

Creates a new TCP socket for handling Gamespy Protocol

Release ( GamespyTcpStream Stream ) : void

Releases the Stream's SocketAsyncEventArgs back to the pool, and free's up another slot for a new client to connect

보호된 메소드들

메소드 설명
PrepareAccept ( SocketAsyncEventArgs AcceptEventArg ) : void

Once a connection has been received, its handed off here to convert it into our client object, and prepared to be handed off to the parent for processing

ProcessAccept ( GamespyTcpStream Stream ) : void

When a new connection is established, the parent class is responsible for processing the connected client

ShutdownSocket ( ) : void

When called, this method will stop accepting new clients, and stop all I/O ops on all connections. Dispose still needs to be called afterwards!

StartAcceptAsync ( ) : void

Begins accepting a new Connection asynchronously

메소드 상세

Dispose() 공개 메소드

Releases all Objects held by this socket. Will also shutdown the socket if its still running
public Dispose ( ) : void
리턴 void

GamespyTcpSocket() 공개 메소드

Creates a new TCP socket for handling Gamespy Protocol
public GamespyTcpSocket ( int Port, int MaxConnections ) : System
Port int The port this socket will be bound to
MaxConnections int The maximum number of concurrent connections
리턴 System

PrepareAccept() 보호된 메소드

Once a connection has been received, its handed off here to convert it into our client object, and prepared to be handed off to the parent for processing
protected PrepareAccept ( SocketAsyncEventArgs AcceptEventArg ) : void
AcceptEventArg System.Net.Sockets.SocketAsyncEventArgs
리턴 void

ProcessAccept() 보호된 추상적인 메소드

When a new connection is established, the parent class is responsible for processing the connected client
protected abstract ProcessAccept ( GamespyTcpStream Stream ) : void
Stream GamespyTcpStream A GamespyTcpStream object that wraps the I/O AsyncEventArgs and socket
리턴 void

Release() 공개 메소드

Releases the Stream's SocketAsyncEventArgs back to the pool, and free's up another slot for a new client to connect
public Release ( GamespyTcpStream Stream ) : void
Stream GamespyTcpStream The GamespyTcpStream object that is being released.
리턴 void

ShutdownSocket() 보호된 메소드

When called, this method will stop accepting new clients, and stop all I/O ops on all connections. Dispose still needs to be called afterwards!
protected ShutdownSocket ( ) : void
리턴 void

StartAcceptAsync() 보호된 메소드

Begins accepting a new Connection asynchronously
protected StartAcceptAsync ( ) : void
리턴 void

프로퍼티 상세

BufferManager 보호되어 있는 프로퍼티

Buffers for sockets are unmanaged by .NET, which means that memory will get fragmented because the GC can't touch these byte arrays. So we will manage our buffers manually
protected BufferManager,BF2Statistics.Net BufferManager
리턴 BF2Statistics.Net.BufferManager

BufferSizePerEventArg 보호되어 있는 프로퍼티

The amount of bytes each SocketAysncEventArgs object will get assigned to in the buffer manager.
protected int BufferSizePerEventArg
리턴 int

ConcurrentAcceptPoolSize 보호되어 있는 프로퍼티

The initial size of the concurrent accept pool when accepting new connections. High volume of connections will increase the pool size if need be 4 should be a pretty good init compacity since accepting a client is pretty fast
protected int ConcurrentAcceptPoolSize
리턴 int

ConnectionEnforceMode 보호되어 있는 프로퍼티

Determines where the MaxConnectionsEnforcer stops to wait for a spot to open, and allow the connecting client through.
protected EnforceMode ConnectionEnforceMode
리턴 EnforceMode

FullErrorMessage 보호되어 있는 프로퍼티

The error message to display if the server is full. Only works if ConnectionEnforceMode is set to DuringPrepare. If left empty, no message will be sent back to the client
protected string FullErrorMessage
리턴 string

Listener 보호되어 있는 프로퍼티

Our Listening Socket
protected Socket Listener
리턴 Socket

MaxConnectionsEnforcer 보호되어 있는 프로퍼티

Use a Semaphore to prevent more then the MaxNumConnections clients from logging in at once.
protected SemaphoreSlim,System.Threading MaxConnectionsEnforcer
리턴 System.Threading.SemaphoreSlim

MaxNumConnections 보호되어 있는 프로퍼티

Max number of concurrent open and active connections. Increasing this number will also increase the IO Buffer by BufferSizePerEventArg * 2
protected int MaxNumConnections
리턴 int

SocketAcceptPool 보호되어 있는 프로퍼티

A pool of reusable SocketAsyncEventArgs objects for accept operations
protected SocketAsyncEventArgsPool,BF2Statistics.Net SocketAcceptPool
리턴 BF2Statistics.Net.SocketAsyncEventArgsPool

SocketReadWritePool 보호되어 있는 프로퍼티

A pool of reusable SocketAsyncEventArgs objects for receive and send socket operations
protected SocketAsyncEventArgsPool,BF2Statistics.Net SocketReadWritePool
리턴 BF2Statistics.Net.SocketAsyncEventArgsPool

WaitTimeout 보호되어 있는 프로퍼티

If the ConnectionEnforceMode is set to DuringPrepare, then the wait timeout is set here
protected int WaitTimeout
리턴 int