NNG_TCP_OPTIONS(5)

πŸ“¦
version 1.12.0 Β· 4 versions
, in ubuntu stonking

πŸ’… 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, use NNG_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 is false by 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 port 0 at configuration time), because it lets the caller figure out the actual ephemeral port that the system chose. and while the value is of type int, it will be a legal TCP port number β€” that is, a value between 1 and 65535, inclusive. 🎯

🧚 Inherited Options 🧚

generally, the following option values are also available for TCP objects, when appropriate for the context:

  • NNG_OPT_LOCADDR
  • NNG_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