Table of Contents

Class TcpSubscriptionOptions

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

What the built-in TCP transport listens on, and the few socket settings a real deployment has to be able to move.

public sealed class TcpSubscriptionOptions
Inheritance
TcpSubscriptionOptions
Inherited Members

Remarks

It binds Loopback unless told otherwise. The transport authenticates nothing by itself — HELLO's token reaches the application's admission hook and that is the whole of it (design/Subscriptions/04-transport.md § 3) — so a default that bound every interface would put an unauthenticated listener on the public internet the first time somebody ran the sample. The previous implementation did exactly that, which is why the default is named in the design rather than left to whoever writes the host.

The send-side knobs exist for the lag skip, not for throughput. A kernel that happily buffers seconds of frames makes a slow client look fast: the send completes, the engine is told the client kept up, and the ack-based skip has nothing to see until the backlog is already unrecoverable. Bounding what the kernel will absorb — TCP_NOTSENT_LOWAT where the platform has it, a small SendBufferSize where it does not — is what keeps back-pressure visible to the engine (design/Subscriptions/04-transport.md § 4).

Constructors

TcpSubscriptionOptions()

public TcpSubscriptionOptions()

Properties

Address

The address to bind. Loopback by default: exposing the listener beyond the machine is an explicit decision, because nothing in this transport authenticates a peer.

public IPAddress Address { get; init; }

Property Value

IPAddress

Backlog

How many connections the kernel may hold half-accepted before it refuses them.

public int Backlog { get; init; }

Property Value

int

CloseDrainTimeoutMs

How long a close waits for an in-flight send to reach the kernel before it stops waiting, in milliseconds. A KICK is written and then the link is closed, so this is what makes the reason arrive rather than race the FIN.

public int CloseDrainTimeoutMs { get; init; }

Property Value

int

Default

Every default: loopback, an ephemeral port, no TLS.

public static TcpSubscriptionOptions Default { get; }

Property Value

TcpSubscriptionOptions

HandshakeTimeoutMs

How long a freshly accepted socket has to complete TLS and the 4-byte preamble, in milliseconds, before it is dropped. The HELLO deadline is the connection's own and starts after this (HelloTimeoutMs).

public int HandshakeTimeoutMs { get; init; }

Property Value

int

MaxInboundMessageBytes

The largest framed client message this transport will read after the first one, in bytes. The first message is HELLO and is bounded by HelloMaxBytes instead, because a client must be able to send a token before it has been told any session's limit.

public int MaxInboundMessageBytes { get; init; }

Property Value

int

Remarks

This is the transport's own ceiling and it is deliberately the loosest of the two: the session's clientMessageBytes is the protocol's limit and only the engine knows it, so a message that passes here can still be refused 1009 by the connection. What this number buys is that an absurd length prefix never turns into an allocation or a read.

NoDelay

Whether to disable Nagle's algorithm. On by default: a frame is a whole message the client cannot act on in halves, so delaying a small one to coalesce it with the next tick's costs a tick of latency for a few bytes.

public bool NoDelay { get; init; }

Property Value

bool

NotSentLowWaterMarkBytes

The TCP_NOTSENT_LOWAT watermark, in bytes, on platforms that have it (Linux). A send completes once the unsent backlog drops below it, so the same bound is expressed without shrinking the window the kernel may use for data already in flight.

public int NotSentLowWaterMarkBytes { get; init; }

Property Value

int

Port

The port to bind. Zero — the default — takes an ephemeral port from the operating system and publishes it as the transport's bound endpoint, which is what a test wants; a host that clients have to find sets the port it advertises.

public int Port { get; init; }

Property Value

int

RequireClientCertificate

Whether the TLS handshake asks for a client certificate. Ignored without a ServerCertificate.

public bool RequireClientCertificate { get; init; }

Property Value

bool

SendBufferBytes

The socket send buffer, in bytes, on platforms without TCP_NOTSENT_LOWAT (Windows). It bounds what the kernel absorbs before a send stops completing immediately, which is what makes a slow client observable to the lag skip rather than invisible behind a megabyte of kernel queue.

public int SendBufferBytes { get; init; }

Property Value

int

ServerCertificate

The server certificate, or null for a plaintext listener. When set, every connection is wrapped in an SslStream and the preamble is exchanged inside TLS, as design/Subscriptions/03-wire-protocol.md § 10 requires.

public X509Certificate2 ServerCertificate { get; init; }

Property Value

X509Certificate2

SslProtocols

The TLS versions to offer. None — the default — takes the operating system's own policy, which is the correct one.

public SslProtocols SslProtocols { get; init; }

Property Value

SslProtocols

Methods

ToEndPoint()

The endpoint Address and Port name.

public IPEndPoint ToEndPoint()

Returns

IPEndPoint

The endpoint to bind.