Interface IConnection
Defines a standard contract for a connection that can be established and disconnected.
public interface IConnection
- Extension Methods
Methods
ConnectAsync(CancellationToken)
Asynchronously connects to a target.
ValueTask ConnectAsync(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationTokenA token to monitor for cancellation requests.
Returns
- ValueTask
A task representing the asynchronous operation.
Disconnect()
Disconnects the current connection.
void Disconnect()
Events
StateChanged
Occurs when the connection state has changed.
event Action<ConnectionStates> StateChanged