C# Class Base.TSocket

封装Socket,将回调push到主线程处理
Inheritance: IDisposable
Datei anzeigen Open project: egametang/Egametang Class Usage Examples

Public Properties

Property Type Description
OnConn Action
OnDisconnect Action
OnRecv SocketError>.Action
OnSend SocketError>.Action

Public Methods

Method Description
AcceptAsync ( TSocket accpetSocket ) : Task
ConnectAsync ( string host, int port ) : bool
Dispose ( ) : void
RecvAsync ( byte buffer, int offset, int count ) : bool
SendAsync ( byte buffer, int offset, int count ) : bool
TSocket ( TPoller poller ) : System
TSocket ( TPoller poller, string host, int port ) : System

Private Methods

Method Description
Bind ( string host, int port ) : void
Listen ( int backlog ) : void
OnAcceptComplete ( SocketAsyncEventArgs e ) : void
OnComplete ( object sender, SocketAsyncEventArgs e ) : void
OnConnectComplete ( SocketAsyncEventArgs e ) : void
OnDisconnectComplete ( SocketAsyncEventArgs e ) : void
OnRecvComplete ( SocketAsyncEventArgs e ) : void
OnSendComplete ( SocketAsyncEventArgs e ) : void

Method Details

AcceptAsync() public method

public AcceptAsync ( TSocket accpetSocket ) : Task
accpetSocket TSocket
return Task

ConnectAsync() public method

public ConnectAsync ( string host, int port ) : bool
host string
port int
return bool

Dispose() public method

public Dispose ( ) : void
return void

RecvAsync() public method

public RecvAsync ( byte buffer, int offset, int count ) : bool
buffer byte
offset int
count int
return bool

SendAsync() public method

public SendAsync ( byte buffer, int offset, int count ) : bool
buffer byte
offset int
count int
return bool

TSocket() public method

public TSocket ( TPoller poller ) : System
poller TPoller
return System

TSocket() public method

public TSocket ( TPoller poller, string host, int port ) : System
poller TPoller
host string
port int
return System

Property Details

OnConn public_oe property

public Action OnConn
return Action

OnDisconnect public_oe property

public Action OnDisconnect
return Action

OnRecv public_oe property

public Action OnRecv
return SocketError>.Action

OnSend public_oe property

public Action OnSend
return SocketError>.Action