Skip to content

TelnetFraming

Transport-agnostic Telnet framing layer. Separates IAC command sequences from the VT data stream and handles option negotiation (BINARY, SGA, ECHO, NAWS, TERMINAL-TYPE). Works over any IDuplexPipe (TCP, WebSocket, named pipe, etc.).

public sealed class TelnetFraming : IAsyncDisposable

Creates a new Telnet framing layer over a bidirectional pipe.

public TelnetFraming(IDuplexPipe pipe)

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.

Sends the initial Telnet negotiation and runs the receive/send loops until the transport closes or cancellation is requested.

public Task RunAsync(CancellationToken ct)

Task

VT data reader (IAC stripped) — connect to StreamedReplHost.

public ChannelTextReader Input { get; }

ChannelTextReader

VT data writer (auto-escapes 0xFF) — connect to StreamedReplHost.

public TextWriter Output { get; }

TextWriter

Terminal type reported by the client, if any.

public string? TerminalType { get; }

string

Raised when the client reports a terminal type through TERMINAL-TYPE negotiation.

public event EventHandler<TelnetFraming.TerminalTypeEventArgs>? TerminalTypeChanged

EventHandler<TelnetFraming.TerminalTypeEventArgs>

Raised when the client sends a NAWS subnegotiation with a new window size.

public event EventHandler<WindowSizeEventArgs>? WindowSizeChanged

EventHandler<WindowSizeEventArgs>