Table of Contents

Class MultiplexingStream.Channel

Namespace
Nerdbank.Streams
Assembly
Nerdbank.Streams.dll

An individual channel within a MultiplexingStream.

public class MultiplexingStream.Channel : IDisposableObservable, IDisposable, IDuplexPipe
Inheritance
MultiplexingStream.Channel
Implements
Inherited Members
Extension Methods

Properties

Acceptance

Gets a Task that completes when the channel is accepted, rejected, or canceled.

public Task Acceptance { get; }

Property Value

Task

Remarks

If the channel is accepted, this task transitions to RanToCompletion state. If the channel offer is canceled, this task transitions to a Canceled state. If the channel offer is rejected, this task transitions to a Canceled state.

Completion

Gets a Task that completes when the channel is disposed, which occurs when Dispose() is invoked or when both sides have indicated they are done writing to the channel.

public Task Completion { get; }

Property Value

Task

Id

Gets the unique ID for this channel.

[Obsolete("Use QualifiedId instead.")]
public int Id { get; }

Property Value

int

Remarks

This value is usually shared for an anonymous channel so the remote party can accept it with AcceptChannel(int, ChannelOptions?) or reject it with RejectChannel(int).

Input

Gets the reader used to receive data over the channel.

public PipeReader Input { get; }

Property Value

PipeReader

Exceptions

NotSupportedException

Thrown if the channel was created with a non-null value in ExistingPipe.

IsDisposed

Gets a value indicating whether this instance has been disposed.

public bool IsDisposed { get; }

Property Value

bool

true if this instance has been disposed.

MultiplexingStream

Gets the underlying MultiplexingStream instance.

public MultiplexingStream MultiplexingStream { get; }

Property Value

MultiplexingStream

Output

Gets the writer used to transmit data over the channel.

public PipeWriter Output { get; }

Property Value

PipeWriter

Exceptions

NotSupportedException

Thrown if the channel was created with a non-null value in ExistingPipe.

QualifiedId

Gets the unique ID for this channel.

public MultiplexingStream.QualifiedChannelId QualifiedId { get; }

Property Value

MultiplexingStream.QualifiedChannelId

Remarks

This value is usually shared for an anonymous channel so the remote party can accept it with AcceptChannel(int, ChannelOptions?) or reject it with RejectChannel(int).

TraceSource

Gets the mechanism used for tracing activity related to this channel.

public TraceSource? TraceSource { get; }

Property Value

TraceSource

Methods

Dispose()

Immediately terminates the channel and shuts down any ongoing communication.

public void Dispose()

Remarks

Because this method may terminate the channel immediately and thus can cause previously queued content to not actually be received by the remote party, consider this method a "break glass" way of terminating a channel. The preferred method is that both sides "complete writing" and let the channel dispose itself.