Table of Contents

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
Inheritance
StreamConnection
Implements
Inherited Members

Constructors

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

Creates a framed connection over stream.

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

Parameters

stream Stream
remoteEndpoint string
ownsStream bool
maxMessageSize int
frameReadIdleTimeout TimeSpan?

Properties

IsConnected

Gets whether the channel is currently connected.

public bool IsConnected { get; }

Property Value

bool

RemoteEndpoint

Gets a string representation of the remote endpoint.

public string RemoteEndpoint { get; }

Property Value

string

Methods

CloseAsync(CancellationToken)

Closes the connection. This operation is idempotent.

public Task CloseAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task

DisposeAsync()

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

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

ReceiveAsync(CancellationToken)

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

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

Parameters

ct CancellationToken

Returns

Task<Payload>

ReceiveFrameValueAsync(CancellationToken)

public ValueTask<RpcFrame> ReceiveFrameValueAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

ValueTask<RpcFrame>

ReceiveValueAsync(CancellationToken)

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

Parameters

ct CancellationToken

Returns

ValueTask<Payload>

SendAsync(ReadOnlyMemory<byte>, CancellationToken)

Sends a framed message over the channel.

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

Parameters

data ReadOnlyMemory<byte>
ct CancellationToken

Returns

Task

SendFrameValueAsync(PooledBufferWriter, CancellationToken)

public ValueTask SendFrameValueAsync(PooledBufferWriter frame, CancellationToken ct = default)

Parameters

frame PooledBufferWriter
ct CancellationToken

Returns

ValueTask

SendValueAsync(ReadOnlyMemory<byte>, CancellationToken)

public ValueTask SendValueAsync(ReadOnlyMemory<byte> data, CancellationToken ct = default)

Parameters

data ReadOnlyMemory<byte>
ct CancellationToken

Returns

ValueTask