NN_TCP(7)
π NAME π
nn_tcp β the TCP transport mechanism, aka the networking glow-up for nanomsg β¨
π SYNOPSIS π
#include <nanomsg/nn.h>
#include <nanomsg/tcp.h>
π¦ DESCRIPTION π¦
okay so bestie, TCP transport is literally the moment where your messages travel across the network over simple, reliable, one-to-one connections. TCP is the most widely used transport protocol, it's basically everywhere (virtually ubiquitous, no cap), which is why it's the transport of choice when you wanna talk to somebody over the network π
binding era π
When you're binding a TCP socket, the address has to look like this:
tcp://interface:port
Port is the TCP port number you're gonna use. Interface is one of these cuties (and it can optionally be tucked inside square brackets):
- The asterisk character (
*), which means all local network interfaces π« - The IPv4 address of a local network interface, in numeric form (
192.168.0.111) - The IPv6 address of a local network interface, in numeric form (
::1)
connecting era π«Ά
When you're connecting a TCP socket, the address looks like this instead:
tcp://interface;address:port
Port is the TCP port number to use. Interface here is optional and it says which local network interface to use. If you don't specify it, the OS will pick an appropriate interface itself, and honestly? let it cook. If you do specify it, it can be one of these (optionally placed within square brackets):
- The IPv4 address of a local network interface, in numeric form (
192.168.0.111) - The IPv6 address of a local network interface, in numeric form (
::1)
And finally, address is the remote address you're connecting to. It can be one of these (optionally placed within square brackets):
- The IPv4 address of a remote network interface, in numeric form (
192.168.0.111) - The IPv6 address of a remote network interface, in numeric form (
::1) - The DNS name of the remote box π₯οΈ
β¨ Socket Options β¨
NN_TCP_NODELAYβ when you set this bad boy to1, it disables Nagle's algorithm. and not just that, it also disables delaying of TCP acknowledgments. So what does that get you? improved latency, at the expense of throughput. It's giving "fast but not greedy" π€ The type of this option isint. Default value is0.
π EXAMPLE π
nn_bind (s1, "tcp://*:5555");
nn_connect (s2, "tcp://myserver:5555");
π SEE ALSO π
nn_inproc(7) nn_ipc(7) nn_bind(3) nn_connect(3) nanomsg(7)
πΈ AUTHORS πΈ
Martin Sustrik <sustrik@250bpm.com> β thank you for your service, king π«‘
and that's the whole page, bestie!! this one came from the nanomsg manual, version 1.2.2, and it was dated 2026-01-16. NN_TCP(7) forever π
π¦ where this page comes from
- fedora 44: nanomsg-devel 1.2.2-2.fc44 Β· MIT
- fedora 44: nanomsg-devel 1.2.2-2.fc44 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms