MTSC  1.0.5
Build TCP servers out of modules with handlers for communication, exception and logging.
MTSC.Client.Client Class Reference

Base class for TCP Client. More...

Public Member Functions

 Client (bool useSsl=false)
 
void QueueMessage (byte[] message)
 Add a message to the message queue. More...
 
void Log (string log)
 Logs the message onto the associated loggers. More...
 
void LogDebug (string debugMessage)
 Logs the debug message onto the associated loggers. More...
 
Client SetServerAddress (string address)
 Sets the server address. More...
 
Client SetPort (int port)
 Sets the server port. More...
 
Client AddHandler (IHandler handler)
 Adds a handler onto the client. More...
 
Client AddExceptionHandler (IExceptionHandler handler)
 Adds an exception handler to the client. More...
 
Client AddLogger (ILogger logger)
 Adds a logger onto the client. More...
 
bool Connect ()
 Attemps to connect to the specified server. More...
 
Task< bool > ConnectAsync ()
 Attempts to connect to the specified server. More...
 
void Disconnect ()
 Disconnects from the server. More...
 

Properties

bool Connected [get]
 
string Address [get]
 
int Port [get]
 
RemoteCertificateValidationCallback CertificateValidationCallback [get, set]
 Callback function used to determine if the remote certificate is valid. More...
 

Detailed Description

Base class for TCP Client.

Definition at line 19 of file Client.cs.

Member Function Documentation

◆ AddExceptionHandler()

Client MTSC.Client.Client.AddExceptionHandler ( IExceptionHandler  handler)

Adds an exception handler to the client.

Parameters
handlerException handler to be added.
Returns
This client object.

Definition at line 120 of file Client.cs.

◆ AddHandler()

Client MTSC.Client.Client.AddHandler ( IHandler  handler)

Adds a handler onto the client.

Parameters
handlerConnection handler object.
Returns
This client object.

Definition at line 110 of file Client.cs.

◆ AddLogger()

Client MTSC.Client.Client.AddLogger ( ILogger  logger)

Adds a logger onto the client.

Parameters
loggerLogger to be added.
Returns
This client object.

Definition at line 130 of file Client.cs.

◆ Connect()

bool MTSC.Client.Client.Connect ( )

Attemps to connect to the specified server.

Returns
True if connection was successful.

Definition at line 143 of file Client.cs.

◆ ConnectAsync()

Task<bool> MTSC.Client.Client.ConnectAsync ( )

Attempts to connect to the specified server.

Returns
True if the connection was successful.

Definition at line 193 of file Client.cs.

◆ Disconnect()

void MTSC.Client.Client.Disconnect ( )

Disconnects from the server.

Definition at line 200 of file Client.cs.

◆ Log()

void MTSC.Client.Client.Log ( string  log)

Logs the message onto the associated loggers.

Parameters
logMessage to be logged.

Definition at line 67 of file Client.cs.

◆ LogDebug()

void MTSC.Client.Client.LogDebug ( string  debugMessage)

Logs the debug message onto the associated loggers.

Parameters
debugMessage

Definition at line 78 of file Client.cs.

◆ QueueMessage()

void MTSC.Client.Client.QueueMessage ( byte []  message)

Add a message to the message queue.

Parameters
messageMessage to be sent.

Definition at line 59 of file Client.cs.

◆ SetPort()

Client MTSC.Client.Client.SetPort ( int  port)

Sets the server port.

Parameters
portPort of the server.
Returns
This client object.

Definition at line 100 of file Client.cs.

◆ SetServerAddress()

Client MTSC.Client.Client.SetServerAddress ( string  address)

Sets the server address.

Parameters
addressAddress of the server.
Returns
This client object.

Definition at line 90 of file Client.cs.

Property Documentation

◆ CertificateValidationCallback

RemoteCertificateValidationCallback MTSC.Client.Client.CertificateValidationCallback
getset

Callback function used to determine if the remote certificate is valid.

Definition at line 138 of file Client.cs.


The documentation for this class was generated from the following file: