Table of Contents

Class TcpFactoryConfig

Namespace
MarymoorStudios.Core.Rpc.Net
Assembly
MarymoorStudios.Core.Rpc.Net.dll

Configures policy for TcpFactory<TRoot>.

public sealed class TcpFactoryConfig
Inheritance
TcpFactoryConfig
Inherited Members

Constructors

TcpFactoryConfig()

Constructor.

public TcpFactoryConfig()

Fields

DefaultTcpPort

The default port for use with TcpListener.

public const int DefaultTcpPort = 2590

Field Value

int

Properties

Backlog

Maximum number of sockets allowed in the accept queue.

public int Backlog { get; init; }

Property Value

int

CertificateManager

(Optional) TLS Certificate Manager. If non-null then TLS will be used, otherwise non-TLS.

public CertificateManager? CertificateManager { get; init; }

Property Value

CertificateManager

MaxRecvPacket

Maximum size of recv packets.

public int MaxRecvPacket { get; init; }

Property Value

int

Remarks

Messages larger than this are split across multiple receives.

This is largely for testing purposes.

MaxSendPacket

Maximum size of send packets.

public int MaxSendPacket { get; init; }

Property Value

int

Remarks

Messages larger than this are split into multiple sends.

This is largely for testing purposes but may be useful in environments where the network prohibits large payloads. Splitting messages across sends lends to the need to perform reassembly on the receiving side increasing costs in memory, CPU, and kernel transitions.

RingCapacity

Maximum number of items in the send/receive buffer between the channel and the network.

public ushort RingCapacity { get; init; }

Property Value

ushort

Remarks

The buffers are used to pipeline transitions between IO completion threads and the Sip-thread for the MarymoorStudios.Core.Rpc.CommChannel they are servicing.

If this value is too small:

  • Sending The MarymoorStudios.Core.Rpc.CommChannel will stall more often and be forced to buffer outgoing messages in its own queue leading potentially to increased GC memory usage and additional send latency.
  • Receiving IO completion threads will stall more often and be forced to provide network backpressure impacting network transmission speeds.

If this value is too large then buffer memory will be wasted for each MarymoorStudios.Core.Rpc.CommChannel. Buffer capacity is a fixed allocation with the same lifetime as the MarymoorStudios.Core.Rpc.CommChannel.

Ideally this value matches the maximum number of messages in flight in either direction under normal operating conditions. When these conditions are exceeded then stalling is the best responses for the system and the network providing backpressure to slow production in either direction to avoid resource exhaustion.

RingThreshold

Maximum The number of item slots that must be available before send backpressure is lifted.

public ushort RingThreshold { get; init; }

Property Value

ushort

Methods

TryParseEndpoint(string, out IPEndPoint)

Convenience function for parsing endpoint strings at the command line.

public static bool TryParseEndpoint(string endpointString, out IPEndPoint endpoint)

Parameters

endpointString string

The string to be parsed.

endpoint IPEndPoint

If successful, the endpoint.

Returns

bool

True if successful, false otherwise.