IConnection
Ecng.Net
Defines an asynchronous contract for a connection that can be established and disconnected.
Methoden
ConnectAsync
public ValueTask ConnectAsync(CancellationToken cancellationToken)
result = iConnection.ConnectAsync(cancellationToken)
Asynchronously connects to a target.
- cancellationToken
- A token to monitor for cancellation requests.
Rückgabe: A task representing the asynchronous operation.
DisconnectAsync
public ValueTask DisconnectAsync(CancellationToken cancellationToken)
result = iConnection.DisconnectAsync(cancellationToken)
Asynchronously disconnects the current connection.
- cancellationToken
- A token to monitor for cancellation requests.
Rückgabe: A task representing the asynchronous operation.
Ereignisse
StateChanged
public event Func<ConnectionStates, CancellationToken, ValueTask> StateChanged
iConnection.StateChanged += handler
Occurs when the connection state has changed.