Search Results for

    Show / Hide Table of Contents

    Interface ITransportConnection

    Abstraction over a bidirectional transport connection (TCP, TLS, QUIC, test).

    Encapsulates all I/O machinery: pipes, pump loops, buffer management, and flush batching. The actor writes bytes in, reads bytes out, and never touches streams or sockets directly.

    Inherited Members
    IAsyncDisposable.DisposeAsync()
    Namespace: Akka.IO
    Assembly: Akka.dll
    Syntax
    public interface ITransportConnection : IAsyncDisposable

    Properties

    | Edit this page View Source

    HasReadError

    Returns true if the read pump encountered an I/O error. This is set BEFORE the input pipe writer is completed, so the actor can check it synchronously when handling a completed pipe read to distinguish error-EOF from normal EOF, even before the ReadCompleted task has been observed.

    Declaration
    bool HasReadError { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    Input

    Pipe reader for inbound data (data received from the remote peer). The actor reads from this to get Tcp.Received data.

    Declaration
    PipeReader Input { get; }
    Property Value
    Type Description
    PipeReader
    | Edit this page View Source

    ReadCompleted

    Completes when the read pump finishes. Check IsFaulted to determine whether the read ended due to an I/O error (vs. normal EOF). The input PipeWriter is always completed WITHOUT passing the exception, so buffered data is preserved and the actor can drain it before checking this task.

    Declaration
    Task ReadCompleted { get; }
    Property Value
    Type Description
    Task
    | Edit this page View Source

    ReadError

    The exception that caused the read pump to fail, or null if no error. Set at the same time as HasReadError.

    Declaration
    Exception? ReadError { get; }
    Property Value
    Type Description
    Exception
    | Edit this page View Source

    WriteCompleted

    Completes when the write pump finishes (all buffered data flushed to the stream).

    Declaration
    Task WriteCompleted { get; }
    Property Value
    Type Description
    Task

    Methods

    | Edit this page View Source

    Abort()

    Abort: RST the connection immediately, no flush.

    Declaration
    void Abort()
    | Edit this page View Source

    CloseAsync()

    Full close: flushes remaining writes, closes the connection.

    Declaration
    Task CloseAsync()
    Returns
    Type Description
    Task
    | Edit this page View Source

    FlushAsync(CancellationToken)

    Explicitly flushes any buffered data to the write pump. Useful for low-throughput scenarios where writes don't fill the buffer. Under high throughput, the buffer auto-flushes at the pause threshold.

    Declaration
    ValueTask<FlushResult> FlushAsync(CancellationToken ct = default)
    Parameters
    Type Name Description
    CancellationToken ct
    Returns
    Type Description
    ValueTask<FlushResult>
    | Edit this page View Source

    ShutdownAsync()

    Half-close: flushes remaining writes, sends FIN, keeps reading.

    Declaration
    Task ShutdownAsync()
    Returns
    Type Description
    Task
    | Edit this page View Source

    WriteAsync(ReadOnlySequence<byte>, CancellationToken)

    Writes a multi-segment sequence to the transport. Each segment is copied into the internal buffer. This avoids per-segment syscalls.

    Declaration
    ValueTask<FlushResult> WriteAsync(ReadOnlySequence<byte> data, CancellationToken ct = default)
    Parameters
    Type Name Description
    ReadOnlySequence<byte> data
    CancellationToken ct
    Returns
    Type Description
    ValueTask<FlushResult>
    | Edit this page View Source

    WriteAsync(ReadOnlyMemory<byte>, CancellationToken)

    Writes data to the transport. Bytes are copied into an internal buffer and will be flushed to the underlying stream by the write pump. Returns when bytes are accepted into the buffer (not when sent on the wire). Goes async when backpressure is active (buffer full).

    Declaration
    ValueTask<FlushResult> WriteAsync(ReadOnlyMemory<byte> data, CancellationToken ct = default)
    Parameters
    Type Name Description
    ReadOnlyMemory<byte> data
    CancellationToken ct
    Returns
    Type Description
    ValueTask<FlushResult>

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET