Table of Contents

Interface IMultiplexedConnection

Namespace
IceRpc.Transports
Assembly
IceRpc.dll

Represents a transport connection created by a multiplexed transport.

public interface IMultiplexedConnection : IAsyncDisposable
Inherited Members

Remarks

The IceRPC core implementation uses this interface. It provides the following guarantees:

Methods

AcceptStreamAsync(CancellationToken)

Accepts a remote stream.

ValueTask<IMultiplexedStream> AcceptStreamAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A cancellation token that receives the cancellation requests.

Returns

ValueTask<IMultiplexedStream>

A task that completes successfully with the remote stream. This task can also complete with one of the following exceptions:

Exceptions

InvalidOperationException

Thrown if ConnectAsync(CancellationToken) did not complete successfully prior to this call.

IceRpcException

Thrown if the connection is closed.

ObjectDisposedException

Thrown if the connection has been disposed.

CloseAsync(MultiplexedConnectionCloseError, CancellationToken)

Closes the connection.

Task CloseAsync(MultiplexedConnectionCloseError closeError, CancellationToken cancellationToken)

Parameters

closeError MultiplexedConnectionCloseError

The error to transmit to the peer.

cancellationToken CancellationToken

A cancellation token that receives the cancellation requests.

Returns

Task

A task that completes once the connection closure completes successfully. This task can also complete with one of the following exceptions:

Exceptions

InvalidOperationException

Thrown if ConnectAsync(CancellationToken) did not complete successfully prior to this call, or if this method is called more than once.

ObjectDisposedException

Thrown if the connection has been disposed.

ConnectAsync(CancellationToken)

Connects this connection.

Task<TransportConnectionInformation> ConnectAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A cancellation token that receives the cancellation requests.

Returns

Task<TransportConnectionInformation>

A task that completes successfully with transport connection information when the connection is established. This task can also complete with one of the following exceptions:

Exceptions

InvalidOperationException

Thrown if this method is called more than once.

ObjectDisposedException

Thrown if the connection has been disposed.

CreateStreamAsync(bool, CancellationToken)

Creates a local stream. The creation will block if the maximum number of unidirectional or bidirectional streams prevents creating the new stream.

ValueTask<IMultiplexedStream> CreateStreamAsync(bool bidirectional, CancellationToken cancellationToken)

Parameters

bidirectional bool

true to create a bidirectional stream, otherwise, false.

cancellationToken CancellationToken

A cancellation token that receives the cancellation requests.

Returns

ValueTask<IMultiplexedStream>

The task that completes on the local stream is created.

Exceptions

InvalidOperationException

Thrown if ConnectAsync(CancellationToken) did not complete successfully prior to this call.

IceRpcException

Thrown if the connection is closed.

ObjectDisposedException

Thrown if the connection has been disposed.