C# Class OpenNos.Core.Networking.Communication.Scs.Client.ScsClientBase

This class provides base functionality for client Classs.
Inheritance: IScsClient
Mostrar archivo Open project: OpenNos/OpenNos

Public Methods

Method Description
ClearLowPriorityQueue ( ) : System.Threading.Tasks.Task
Connect ( ) : void

Connects to server.

Disconnect ( ) : void

Disconnects from server. Does nothing if already disconnected.

Dispose ( ) : void

Disposes this object and closes underlying connection.

SendMessage ( IScsMessage message, byte priority ) : void

Sends a message to the server.

Protected Methods

Method Description
CreateCommunicationChannel ( ) : ICommunicationChannel

This method is implemented by derived Classs to create appropriate communication channel.

Dispose ( bool disposing ) : void
OnConnected ( ) : void

Raises Connected event.

OnDisconnected ( ) : void

Raises Disconnected event.

OnMessageReceived ( IScsMessage message ) : void

Raises MessageReceived event.

OnMessageSent ( IScsMessage message ) : void

Raises MessageSent event.

ScsClientBase ( ) : OpenNos.Core.Networking.Communication.Scs.Communication

Constructor.

Private Methods

Method Description
CommunicationChannel_Disconnected ( object sender, EventArgs e ) : void

Handles Disconnected event of _communicationChannel object.

CommunicationChannel_MessageReceived ( object sender, MessageEventArgs e ) : void

Handles MessageReceived event of _communicationChannel object.

CommunicationChannel_MessageSent ( object sender, MessageEventArgs e ) : void

Handles MessageSent event of _communicationChannel object.

PingTimer_Elapsed ( object sender, EventArgs e ) : void

Handles Elapsed event of _pingTimer to send PingMessage messages to server.

Method Details

ClearLowPriorityQueue() public method

public ClearLowPriorityQueue ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task

Connect() public method

Connects to server.
public Connect ( ) : void
return void

CreateCommunicationChannel() protected abstract method

This method is implemented by derived Classs to create appropriate communication channel.
protected abstract CreateCommunicationChannel ( ) : ICommunicationChannel
return ICommunicationChannel

Disconnect() public method

Disconnects from server. Does nothing if already disconnected.
public Disconnect ( ) : void
return void

Dispose() public method

Disposes this object and closes underlying connection.
public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

OnConnected() protected method

Raises Connected event.
protected OnConnected ( ) : void
return void

OnDisconnected() protected method

Raises Disconnected event.
protected OnDisconnected ( ) : void
return void

OnMessageReceived() protected method

Raises MessageReceived event.
protected OnMessageReceived ( IScsMessage message ) : void
message IScsMessage Received message
return void

OnMessageSent() protected method

Raises MessageSent event.
protected OnMessageSent ( IScsMessage message ) : void
message IScsMessage Received message
return void

ScsClientBase() protected method

Constructor.
protected ScsClientBase ( ) : OpenNos.Core.Networking.Communication.Scs.Communication
return OpenNos.Core.Networking.Communication.Scs.Communication

SendMessage() public method

Sends a message to the server.
/// Throws a CommunicationStateException if client is not connected to the server. ///
public SendMessage ( IScsMessage message, byte priority ) : void
message IScsMessage Message to be sent
priority byte
return void