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
Type | Name | |
---|---|---|
string | host | Address on which server is listening for clients. |
int | port | Port 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
Type | Name | |
---|---|---|
string | host | Address on which server is listening for clients. |
int | port | Port on which server is listening for clients. |
NetworkConfig | config | Network 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
Type | Name | |
---|---|---|
string | host | Address on which server is listening for clients. |
int | port | Port on which server is listening for clients. |
ClientCredentials | credentials | Client 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
Type | Name | |
---|---|---|
string | host | Address on which server is listening for clients. |
int | port | Port on which server is listening for clients. |
ClientCredentials | credentials | Client credentials used for authentication. |
NetworkConfig | config | Network configuration. |
Client(IPEndPoint)
Initializes a new instance of the TagBites.Net.Client class.
public void Client(IPEndPoint address)
Result Type: void
Parameters
Type | Name | |
---|---|---|
IPEndPoint | address | Address 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
Type | Name | |
---|---|---|
IPEndPoint | address | Address on which server is listening for clients. |
NetworkConfig | config | Network 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
Type | Name | |
---|---|---|
IPEndPoint | address | Address on which server is listening for clients. |
ClientCredentials | credentials | Client 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
Type | Name | |
---|---|---|
IPEndPoint | address | Address on which server is listening for clients. |
ClientCredentials | credentials | Client credentials used for authentication. |
NetworkConfig | config | Network 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
Type | Name | |
---|---|---|
string | serverName | Name 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
Type | Name | |
---|---|---|
object | sender | |
NetworkConnectionControllerResolveEventArgs | e |
OnValidateServerCertificate(object, X509Certificate, X509Chain, SslPolicyErrors)
Validates server certificate.
protected bool OnValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
Result Type: bool
Parameters
Type | Name | |
---|---|---|
object | sender | |
X509Certificate | certificate | |
X509Chain | chain | |
SslPolicyErrors | sslPolicyErrors |
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
Type | Name | |
---|---|---|
TController | controller | Controller instance. |
Events
Connected
Occurs after connection is established to the server and client is authenticated.
public EventHandler Connected
Result Type: EventHandler