Client

Namespace: TagBites.Net
Assembly: TagBites.Net.dll

TCP client which allows to send objects messages and execute remote methods. This class is thread safe.

public class Client : TagBites.Net.NetworkClient

Constructors

Client(string, int)

Initializes a new instance of the TagBites.Net.Client class.

public void Client(string host, int port)

Result Type: void

Parameters

TypeName
stringhostAddress on which server is listening for clients.
intportPort on which server is listening for clients.

Client(string, int, NetworkConfig)

Initializes a new instance of the TagBites.Net.Client class.

public void Client(string host, int port, NetworkConfig config)

Result Type: void

Parameters

TypeName
stringhostAddress on which server is listening for clients.
intportPort on which server is listening for clients.
NetworkConfigconfigNetwork configuration.

Client(string, int, ClientCredentials)

Initializes a new instance of the TagBites.Net.Client class.

public void Client(string host, int port, ClientCredentials credentials)

Result Type: void

Parameters

TypeName
stringhostAddress on which server is listening for clients.
intportPort on which server is listening for clients.
ClientCredentialscredentialsClient credentials used for authentication.

Client(string, int, ClientCredentials, NetworkConfig)

Initializes a new instance of the TagBites.Net.Client class.

public void Client(string host, int port, ClientCredentials credentials, NetworkConfig config)

Result Type: void

Parameters

TypeName
stringhostAddress on which server is listening for clients.
intportPort on which server is listening for clients.
ClientCredentialscredentialsClient credentials used for authentication.
NetworkConfigconfigNetwork configuration.

Client(IPEndPoint)

Initializes a new instance of the TagBites.Net.Client class.

public void Client(IPEndPoint address)

Result Type: void

Parameters

TypeName
IPEndPointaddressAddress on which server is listening for clients.

Client(IPEndPoint, NetworkConfig)

Initializes a new instance of the TagBites.Net.Client class.

public void Client(IPEndPoint address, NetworkConfig config)

Result Type: void

Parameters

TypeName
IPEndPointaddressAddress on which server is listening for clients.
NetworkConfigconfigNetwork configuration.

Client(IPEndPoint, ClientCredentials)

Initializes a new instance of the TagBites.Net.Client class.

public void Client(IPEndPoint address, ClientCredentials credentials)

Result Type: void

Parameters

TypeName
IPEndPointaddressAddress on which server is listening for clients.
ClientCredentialscredentialsClient credentials used for authentication.

Client(IPEndPoint, ClientCredentials, NetworkConfig)

Initializes a new instance of the TagBites.Net.Client class.

public void Client(IPEndPoint address, ClientCredentials credentials, NetworkConfig config)

Result Type: void

Parameters

TypeName
IPEndPointaddressAddress on which server is listening for clients.
ClientCredentialscredentialsClient credentials used for authentication.
NetworkConfigconfigNetwork configuration.

Properties

RemoteEndPoint

Gets the remote endpoint.

public EndPoint RemoteEndPoint { get; }

Result Type: EndPoint

Methods

ConnectAsync()

Starts the connection.

public Task ConnectAsync()

Result Type: Task

ConnectSslAsync()

Starts the SSL connection .

public Task ConnectSslAsync()

Result Type: Task

ConnectSslAsync(string)

Starts the SSL connection.

public Task ConnectSslAsync(string serverName)

Result Type: Task

Parameters

TypeName
stringserverNameName of the server (used for certificate validation).

OnConnected()

Invokes TagBites.Net.Client.Connected event.

protected void OnConnected()

Result Type: void

OnControllerResolve(object, NetworkConnectionControllerResolveEventArgs)

protected void OnControllerResolve(object sender, NetworkConnectionControllerResolveEventArgs e)

Result Type: void

Parameters

TypeName
objectsender
NetworkConnectionControllerResolveEventArgse

OnValidateServerCertificate(object, X509Certificate, X509Chain, SslPolicyErrors)

Validates server certificate.

protected bool OnValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)

Result Type: bool

Parameters

TypeName
objectsender
X509Certificatecertificate
X509Chainchain
SslPolicyErrorssslPolicyErrors

Use<TControllerInterface, TController>()

Register local controller.

public void Use()

Result Type: void

Use<TControllerInterface, TController>(TController)

Register local controller.

public void Use(TController controller)

Result Type: void

Parameters

TypeName
TControllercontrollerController instance.

Events

Connected

Occurs after connection is established to the server and client is authenticated.

public EventHandler Connected

Result Type: EventHandler