NNG_TCP_OPTIONS(5)
π NNG_TCP_OPTIONS(5) π
okay bestie, welcome to the NNG Reference Manual page for nng_tcp_options β TCP-specific options. yes this is the whole page about the lil knobs you can twist on TCP stuff. it's giving niche but essential, fr fr. π¦
β¨ NAME β¨
nng_tcp_options β TCP-specific options πΈ
β¨ SYNOPSIS β¨
#include <nng/nng.h>
#define NNG_OPT_TCP_NODELAY "tcp-nodelay"
#define NNG_OPT_TCP_KEEPALIVE "tcp-keepalive"
#define NNG_OPT_TCP_BOUND_PORT "tcp-bound-port"
β¨ DESCRIPTION β¨
so this page documents all the standard options you can set or retrieve on objects that use TCP. the whole point is that these are the officially standard ones, okay? π
important, bestie: always use option names by their symbolic definitions. like, useNNG_OPT_TCP_NODELAY, not the literal string"tcp-nodelay". the symbols are the moment. π
in the list below, every option comes with its name and the data type of the underlying value, because we're thorough like that.
ALSO: some options are only meaningful or supported in certain contexts, or they have other access restrictions. the good news is they tried to include those details right in each option's description. so read carefully, no skimming. π
the options that follow are generally applicable to objects making use of TCP/IP communications. π
πΈ TCP Options πΈ
NNG_OPT_TCP_NODELAYβ (bool) this one is how you disable (or enable, we love a two-way street) the use of Nagle's algorithm for TCP connections.
Note π β this setting may apply to transports that are built on top of TCP. check the transport documentation for each transport for the deets.
when it's true (which is the default, slay), messages get sent immediately by the underlying TCP stream β no waiting around to gather up more data. instant. main character behavior. β¨
when it's false, Nagle's algorithm is enabled, and the TCP stream may wait briefly in an attempt to coalesce messages. Nagle's algorithm is useful on low-bandwidth connections to reduce overhead, but it comes at a cost to latency. so like... tradeoffs, iykyk. βοΈ
when used on a dialer or a listener, the value affects how newly created connections will be configured. π
NNG_OPT_TCP_KEEPALIVEβ (bool) this one enables the sending of keep-alive messages on the underlying TCP stream. this option isfalseby default. π
Note π β this setting may apply to transports that are built on top of TCP. see the transport documentation for each transport for details.
when enabled, if no messages are seen for a period of time, then a zero length TCP message is sent with the ACK flag set β literally just an attempt to tickle some traffic out of the peer. π if none is still seen (after some platform-specific number of retries and timeouts), then the remote peer is presumed dead, and the connection is closed. rip bozo. πͺ¦
when used on a dialer or a listener, the value affects how newly created connections will be configured. π«Ά
Tip π‘ β this option has two purposes. first, it can be used to detect dead peers on an otherwise quiescent network. second, it can be used to keep connection table entries in NAT and other middleware from being expired due to lack of activity. double duty, no cap. π₯
NNG_OPT_TCP_BOUND_PORTβ (int) this option is available on listeners, after the listener has bound to a port, and it provides the port bound to in native byte order. this is most useful when you're using a listener with an ephemeral port (configured by using port0at configuration time), because it lets the caller figure out the actual ephemeral port that the system chose. and while the value is of typeint, it will be a legal TCP port number β that is, a value between1and65535, inclusive. π―
π§ Inherited Options π§
generally, the following option values are also available for TCP objects, when appropriate for the context:
NNG_OPT_LOCADDRNNG_OPT_REMADDR
β¨ SEE ALSO β¨
nng_tcp_dialer_getopt(3tcp), nng_tcp_dialer_setopt(3tcp), nng_tcp_getopt(3tcp), nng_tcp_listener_getopt(3tcp), nng_tcp_listener_setopt(3tcp), nng_tcp_setopt(3tcp), nng_options(5), nng(7)
okay that's the whole page, bestie, you're officially TCP-option-literate πβ¨ this was the NNG Reference Manual, dated 2026-06-30, and you absolutely ate that reading. periodt. πππ¦π
π¦ where this page comes from
- ubuntu stonking: libnng-dev 1.12.0-1 Β· MIT OR Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms