Skip to content

Transport Options

TransportOptions is the central configuration class for client connectivity in Nalix.SDK. It inherits from ConfigurationLoader, so it can be loaded through ConfigurationManager from the active INI configuration.

Source mapping

  • src/Nalix.SDK/Options/TransportOptions.cs

Role and Design

Tuning a network client involves balancing latency, memory usage, and resilience. TransportOptions provides a strongly-typed interface to control these trade-offs through declarative properties and data-annotation constraints.

  • Resilient Connectivity: Built-in exponential backoff for reconnection.
  • Performance Tuning: Control over TCP Nagle's algorithm (NoDelay) and MTU limits.
  • Security & Efficiency: Configuration for AEAD encryption suites and LZ4 compression.

Configuration Reference

Connection & Connectivity

Property Default Description
Address "127.0.0.1" Server IP address or hostname.
Port 57206 Server port (1–65535).
ConnectTimeoutMillis 5000 Timeout for the initial connection attempt.
ReconnectEnabled true Enables automatic reconnection after a drop.
ReconnectMaxAttempts 0 Max attempts (0 = unlimited).
ReconnectBaseDelayMillis 500 Base delay for exponential backoff.
ReconnectMaxDelayMillis 30000 Maximum delay between attempts.
KeepAliveIntervalMillis 20000 Heartbeat interval (0 = disabled).

Performance & Framing

Property Default Description
NoDelay true Disables Nagle's algorithm for lower latency.
BufferSize 65536 Socket send/receive buffer size in bytes.
AsyncQueueCapacity 1024 Capacity of the internal async message queue.
MaxUdpDatagramSize 1400 Maximum MTU for UDP (including 8-byte Token).

Time Sync

Property Default Description
TimeOffsetMs 0 Current time offset in milliseconds applied by the time synchronization process.

Security & Compression

Property Default Description
CompressionEnabled true Enables LZ4 compression for outbound packets.
CompressionThreshold 512 Minimum bytes to trigger compression.
EncryptionEnabled false Enables AEAD packet encryption.
Algorithm Chacha20Poly1305 Cipher suite for encrypted communication.
ServerPublicKey null Pinned X25519 Public Key (Hex) for server identity verification.
Secret Bytes32.Zero [ConfiguredIgnore] Runtime encryption key populated after handshake or resume.

Session Resume & Time Sync

Property Default Description
SessionToken 0 [ConfiguredIgnore] Runtime session token for resume and UDP flows.
ResumeEnabled true Attempts session resume before full handshake.
ResumeTimeoutMillis 3000 Timeout for resume request/response.
ResumeFallbackToHandshake true Reconnects with full handshake when resume fails.
TimeSyncEnabled true Allows this session to update the global clock during sync.

Basic usage

var options = ConfigurationManager.Instance.Get<TransportOptions>();
options.Address = "server.example.com";

var client = new TcpSession(options, catalog);