C# Class Griffin.Net.ChannelTcpListener

Listens on one of the specified protocols
Inheritance: IMessagingListener
Afficher le fichier Open project: jgauffin/Griffin.Framework

Méthodes publiques

Méthode Description
ChannelTcpListener ( ) : System

ChannelTcpListener ( Griffin.Net.ChannelTcpListenerConfiguration configuration ) : System

Start ( IPAddress address, int port ) : void

Start this listener.

This also pre-configures 20 channels that can be used and reused during the lifetime of this listener.

Stop ( ) : void

Stop the listener.

Méthodes protégées

Méthode Description
Configure ( Griffin.Net.ChannelTcpListenerConfiguration configuration ) : void

To allow the sub classes to configure this class in their constructors.

OnClientConnected ( ITcpChannel channel ) : Griffin.Net.Protocols.ClientConnectedEventArgs

A client has connected (nothing has been sent or received yet)

OnClientDisconnected ( ITcpChannel channel, Exception exception ) : void

A client has disconnected

OnListenerError ( Exception ex ) : void

Invoke when the listener itself fails

OnMessage ( ITcpChannel source, object msg ) : void

Receive a new message from the specified client

Private Methods

Méthode Description
OnAcceptSocket ( IAsyncResult ar ) : void
OnChannelDisconnect ( ITcpChannel source, Exception exception ) : void

Method Details

ChannelTcpListener() public méthode

public ChannelTcpListener ( ) : System
Résultat System

ChannelTcpListener() public méthode

public ChannelTcpListener ( Griffin.Net.ChannelTcpListenerConfiguration configuration ) : System
configuration Griffin.Net.ChannelTcpListenerConfiguration
Résultat System

Configure() protected méthode

To allow the sub classes to configure this class in their constructors.
protected Configure ( Griffin.Net.ChannelTcpListenerConfiguration configuration ) : void
configuration Griffin.Net.ChannelTcpListenerConfiguration
Résultat void

OnClientConnected() protected méthode

A client has connected (nothing has been sent or received yet)
protected OnClientConnected ( ITcpChannel channel ) : Griffin.Net.Protocols.ClientConnectedEventArgs
channel ITcpChannel Channel which we created for the remote socket.
Résultat Griffin.Net.Protocols.ClientConnectedEventArgs

OnClientDisconnected() protected méthode

A client has disconnected
protected OnClientDisconnected ( ITcpChannel channel, Exception exception ) : void
channel ITcpChannel Channel representing the client that disconnected
exception System.Exception /// Exception which was used to detect disconnect (SocketException with status /// Success is created for graceful disconnects) ///
Résultat void

OnListenerError() protected méthode

Invoke when the listener itself fails
protected OnListenerError ( Exception ex ) : void
ex System.Exception Caught exception
Résultat void

OnMessage() protected méthode

Receive a new message from the specified client
protected OnMessage ( ITcpChannel source, object msg ) : void
source ITcpChannel Channel for the client
msg object Message (as decoded by the specified ).
Résultat void

Start() public méthode

Start this listener.
This also pre-configures 20 channels that can be used and reused during the lifetime of this listener.
public Start ( IPAddress address, int port ) : void
address System.Net.IPAddress Address to accept connections on
port int Port to use. Set to 0 to let the OS decide which port to use.
Résultat void

Stop() public méthode

Stop the listener.
public Stop ( ) : void
Résultat void