C# Class FastNetwork.BaseHost

base host
Inheritance: IHost
Show file Open project: zhujunxxxxx/FastNetwork

Protected Properties

Property Type Description
_listConnections ConnectionCollection

Public Methods

Method Description
GetConnectionByID ( long connectionID ) : IConnection

get IConnection by connectionID

GetSocketAsyncEventArgs ( ) : SocketAsyncEventArgs

get

NextConnectionID ( ) : long

生成下一个连接ID

ReleaseSocketAsyncEventArgs ( SocketAsyncEventArgs e ) : void

release

Start ( ) : void

启动

Stop ( ) : void

停止

Protected Methods

Method Description
BaseHost ( int socketBufferSize, int messageBufferSize ) : System

new

OnConnected ( IConnection connection ) : void

OnConnected

OnDisconnected ( IConnection connection, Exception ex ) : void

OnDisconnected

OnError ( IConnection connection, Exception ex ) : void

OnError

OnMessageReceived ( IConnection connection, MessageReceivedEventArgs e ) : void

OnMessageReceived

OnSendCallback ( IConnection connection, SendCallbackEventArgs e ) : void

OnSendCallback

OnStartSending ( IConnection connection, Packet packet ) : void

OnStartSending

RegisterConnection ( IConnection connection ) : void

register connection

Method Details

BaseHost() protected method

new
socketBufferSize messageBufferSize
protected BaseHost ( int socketBufferSize, int messageBufferSize ) : System
socketBufferSize int
messageBufferSize int
return System

GetConnectionByID() public method

get IConnection by connectionID
public GetConnectionByID ( long connectionID ) : IConnection
connectionID long
return IConnection

GetSocketAsyncEventArgs() public method

get
public GetSocketAsyncEventArgs ( ) : SocketAsyncEventArgs
return System.Net.Sockets.SocketAsyncEventArgs

NextConnectionID() public method

生成下一个连接ID
public NextConnectionID ( ) : long
return long

OnConnected() protected method

OnConnected
protected OnConnected ( IConnection connection ) : void
connection IConnection
return void

OnDisconnected() protected method

OnDisconnected
protected OnDisconnected ( IConnection connection, Exception ex ) : void
connection IConnection
ex System.Exception
return void

OnError() protected method

OnError
protected OnError ( IConnection connection, Exception ex ) : void
connection IConnection
ex System.Exception
return void

OnMessageReceived() protected method

OnMessageReceived
protected OnMessageReceived ( IConnection connection, MessageReceivedEventArgs e ) : void
connection IConnection
e FastNetwork.Event.MessageReceivedEventArgs
return void

OnSendCallback() protected method

OnSendCallback
protected OnSendCallback ( IConnection connection, SendCallbackEventArgs e ) : void
connection IConnection
e FastNetwork.Event.SendCallbackEventArgs
return void

OnStartSending() protected method

OnStartSending
protected OnStartSending ( IConnection connection, Packet packet ) : void
connection IConnection
packet Packet
return void

RegisterConnection() protected method

register connection
connection is null
protected RegisterConnection ( IConnection connection ) : void
connection IConnection
return void

ReleaseSocketAsyncEventArgs() public method

release
public ReleaseSocketAsyncEventArgs ( SocketAsyncEventArgs e ) : void
e System.Net.Sockets.SocketAsyncEventArgs
return void

Start() public method

启动
public Start ( ) : void
return void

Stop() public method

停止
public Stop ( ) : void
return void

Property Details

_listConnections protected property

connection collection
protected ConnectionCollection,FastNetwork _listConnections
return ConnectionCollection