Skip to content

Class StreamConnection

Namespace: DotBoxD.Services.Transport
Assembly: DotBoxD.Services.dll

DotBoxD connection over a duplex stream, including named pipe streams.

public sealed class StreamConnection : IRpcFrameChannel, IRpcValueTaskChannel, IRpcChannel, IAsyncDisposable

objectStreamConnection

IRpcFrameChannel, IRpcValueTaskChannel, IRpcChannel, IAsyncDisposable

object.Equals(object), object.Equals(object, object), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object, object), object.ToString()

StreamConnection(Stream, string?, bool, int, TimeSpan?)

Section titled “ StreamConnection(Stream, string?, bool, int, TimeSpan?)”

Creates a framed connection over stream. A null frameReadIdleTimeout uses the finite default frame-read idle timeout. Pass System.Threading.Timeout.InfiniteTimeSpan to disable the timeout for trusted streams.

public StreamConnection(Stream stream, string? remoteEndpoint = null, bool ownsStream = true, int maxMessageSize = 16777216, TimeSpan? frameReadIdleTimeout = null)

stream Stream

remoteEndpoint string?

ownsStream bool

maxMessageSize int

frameReadIdleTimeout TimeSpan?

Gets whether the channel is currently connected.

public bool IsConnected { get; }

bool

Gets a string representation of the remote endpoint.

public string RemoteEndpoint { get; }

string

Closes the connection. This operation is idempotent.

public Task CloseAsync(CancellationToken ct = default)

ct CancellationToken

Task

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public ValueTask DisposeAsync()

ValueTask

A task that represents the asynchronous dispose operation.

Receives a framed message. The caller owns the returned DotBoxD.Services.Buffers.Payload and must dispose it. A payload with DotBoxD.Services.Buffers.Payload.Length of 0 signals the channel was closed.

public Task<Payload> ReceiveAsync(CancellationToken ct = default)

ct CancellationToken

Task<Payload>

ReceiveFrameValueAsync(CancellationToken)

Section titled “ ReceiveFrameValueAsync(CancellationToken)”
public ValueTask<RpcFrame> ReceiveFrameValueAsync(CancellationToken ct = default)

ct CancellationToken

ValueTask<RpcFrame>

public ValueTask<Payload> ReceiveValueAsync(CancellationToken ct = default)

ct CancellationToken

ValueTask<Payload>

SendAsync(ReadOnlyMemory<byte>, CancellationToken)

Section titled “ SendAsync(ReadOnlyMemory<byte>, CancellationToken)”

Sends a framed message over the channel.

public Task SendAsync(ReadOnlyMemory<byte> data, CancellationToken ct = default)

data ReadOnlyMemory<byte>

ct CancellationToken

Task

SendFrameValueAsync(PooledBufferWriter, CancellationToken)

Section titled “ SendFrameValueAsync(PooledBufferWriter, CancellationToken)”
public ValueTask SendFrameValueAsync(PooledBufferWriter frame, CancellationToken ct = default)

frame PooledBufferWriter

ct CancellationToken

ValueTask

SendValueAsync(ReadOnlyMemory<byte>, CancellationToken)

Section titled “ SendValueAsync(ReadOnlyMemory<byte>, CancellationToken)”
public ValueTask SendValueAsync(ReadOnlyMemory<byte> data, CancellationToken ct = default)

data ReadOnlyMemory<byte>

ct CancellationToken

ValueTask