NetworkClient
Namespace: TagBites.Net
Assembly: TagBites.Net.dll
Product: TagBites.Net v. 1.0.3
TCP client which allows to send objects messages and execute remote methods. This class is thread safe.
public abstract class NetworkClient : System.IDisposableInheritance: object → NetworkClient
Derived:
Constructors
Section titled “Constructors”NetworkClient()
Section titled “NetworkClient()”protected NetworkClient()Properties
Section titled “Properties”IsConnected
Section titled “IsConnected”Gets a value indicating whether connection is active.
public bool IsConnected { get; }Property Value
Section titled “Property Value”IsDisposed
Section titled “IsDisposed”Gets a value indicating whether the object has been disposed.
public bool IsDisposed { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Close()
Section titled “Close()”Closes the connection.
public void Close()Dispose()
Section titled “Dispose()”public virtual void Dispose()Dispose(bool)
Section titled “Dispose(bool)”Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
protected virtual void Dispose(bool disposing)Parameters
Section titled “Parameters”disposingbool
GetController<T>()
Section titled “GetController<T>()”Returns the remote controller.
public T GetController()Type Parameters
Section titled “Type Parameters”T
Type of controller.
Returns
Section titled “Returns”T
Remote controller.
OnConnectionClosed(object, NetworkConnectionClosedEventArgs)
Section titled “OnConnectionClosed(object, NetworkConnectionClosedEventArgs)”Invokes Disconnected event.
protected virtual void OnConnectionClosed(object sender, NetworkConnectionClosedEventArgs e)Parameters
Section titled “Parameters”senderobjecteNetworkConnectionClosedEventArgs
OnControllerResolve(object, NetworkConnectionControllerResolveEventArgs)
Section titled “OnControllerResolve(object, NetworkConnectionControllerResolveEventArgs)”Invokes ControllerResolve event.
protected virtual void OnControllerResolve(object sender, NetworkConnectionControllerResolveEventArgs e)Parameters
Section titled “Parameters”OnReceived(object, NetworkConnectionMessageEventArgs)
Section titled “OnReceived(object, NetworkConnectionMessageEventArgs)”Invokes Received event.
protected virtual void OnReceived(object sender, NetworkConnectionMessageEventArgs e)Parameters
Section titled “Parameters”senderobjecteNetworkConnectionMessageEventArgs
OnReceivedError(object, NetworkConnectionMessageErrorEventArgs)
Section titled “OnReceivedError(object, NetworkConnectionMessageErrorEventArgs)”Invokes ReceivedError event.
protected virtual void OnReceivedError(object sender, NetworkConnectionMessageErrorEventArgs e)Parameters
Section titled “Parameters”SendAsync(object)
Section titled “SendAsync(object)”public Task SendAsync(object message)Parameters
Section titled “Parameters”messageobject
Returns
Section titled “Returns”Events
Section titled “Events”ControllerResolve
Section titled “ControllerResolve”Occurs when server requests access to controller for the first time. It allows to create and return controller instance without register it first.
public EventHandler<NetworkConnectionControllerResolveEventArgs> ControllerResolveEvent Type
Section titled “Event Type”EventHandler<NetworkConnectionControllerResolveEventArgs>
Disconnected
Section titled “Disconnected”Occurs when client disconnects form the server.
public EventHandler<NetworkConnectionClosedEventArgs> DisconnectedEvent Type
Section titled “Event Type”EventHandler<NetworkConnectionClosedEventArgs>
Received
Section titled “Received”Occurs when server sends a message.
public EventHandler<NetworkConnectionMessageEventArgs> ReceivedEvent Type
Section titled “Event Type”EventHandler<NetworkConnectionMessageEventArgs>
ReceivedError
Section titled “ReceivedError”Occurs when client was unable to receive server message (eg. deserialization error).
public EventHandler<NetworkConnectionMessageErrorEventArgs> ReceivedError