S6-TCPSERVERD(8)

πŸ“¦ version 2.8.0.1, in nixpkgs unstable

πŸ’… S6-TCPSERVERD(8) β€” like, the serving part of the s6-tcpserver(8) super-server, bestie

okay so this is a page from the System Manager's Manual and it's about s6-tcpserverd and honestly? it's giving tiny-but-mighty. let's go πŸŽ€


✨ NAME ✨

s6-tcpserverd β€” the serving part of the s6-tcpserver(8) super-server. that's it, that's the vibe πŸ¦‹


🌸 SYNOPSIS 🌸

s6-tcpserverd s6-tcpserverd [-1] [-v verbosity] [-c maxconn] file ... -C
              localmaxconn prog...

like yes bestie, the name really does appear twice, that's not a typo, that's just how it is πŸ’…


πŸ’– DESCRIPTION πŸ’–

so s6-tcpserverd is the serving part of the s6-tcpserver(8) super-server. it literally assumes its stdin is a bound and listening TCP/IP socket, and then it just... accepts connections from clients connecting to it, spawning a program to handle each one. main character energy fr fr πŸ‘‘

s6-tcpserverd accepts connections from clients to an already bound and listening TCP socket which is its standard input. no notes, that's the whole setup ✨

for every TCP connection to this socket, it spawns a prog... child with stdin reading from the network socket and stdout writing to it. cute, efficient, slay 🫢

depending on the verbosity level, it logs what it does to stderr. lowkey nosy, highkey useful πŸ’œ

it runs until killed by a signal. and depending on the received signal, it may kill its children before exiting β€” so like, it's not gonna leave its kids hanging 😭

unlike its ancestor tcpserver[1], s6-tcpserverd performs just the bare minimum: the point is to have a small and very fast process to serve connections with the least possible overhead. it's giving minimalism, it's giving efficiency, it's giving no baggage πŸ’€βœ¨ features such as access control and DNS resolution are provided via the s6-tcpserver-access(8) program β€” different icon, different job πŸŽ€

s6-tcpserverd is meant to be execve(2)'d into by a program that gets the listening socket. that program is normally s6-tcpserver-socketbinder(8), which creates the socket itself; but it can be a different one if the socket is to be retrieved by another means, for instance by fd-passing from a fd-holding daemon (some people call this β€œsocket activation” β€” iykyk 🧚).

okay and here's a lil interface note that matters: the option to make s6-tcpserverd verbose is -v 2, where the verbosity level is given as an argument, 0 being quiet, 1 normal and 2 verbose. this is different from the s6-tcpserver(8) interface, where -v without an argument would indicate extra verbosity. the difference exists because s6-tcpserver(8) follows the UCSPI tool[2] interface, whereas s6-tcpserverd has no such constraint, and giving the verbosity level as a number is a better interface. periodt πŸ’…

⚑ Signals ⚑

  • SIGTERM β€” Exit. bye bestie πŸ‘‹
  • SIGHUP β€” Send a SIGTERM and a SIGCONT to all children. not me forwarding signals to the whole group chat πŸ“¨
  • SIGQUIT β€” Send a SIGTERM and a SIGCONT to all children, then exit. so it's a "you're all coming with me" situation πŸ’€
  • SIGABRT β€” Send a SIGKILL to all children, then exit. no warnings, no mercy, straight to the shadow realm 😭πŸ”₯

πŸ‘‘ OPTIONS πŸ‘‘

  • -1 β€” Write the local port, followed by newline, to stdout, and close stdout, right before entering the client-accepting loop. if stdout is suitably redirected, this can be used by monitoring programs to check when the server is accepting connections. and get this β€” it can be used with s6's s6-notifywhenup(7) readiness notification mechanism to make sure subsequent services do not start before the server is ready. it's literally the "i'm ready, everyone can come in" text message 🫢✨
  • -v verbosity β€” Be more or less verbose. By default, verbosity is 1: print warning messages to stderr. 0 means only print fatal error messages; 2 means print status and connection information for every client. choose your own adventure, bestie πŸ¦‹
  • -c maxconn β€” Accept at most maxconn concurrent connections. Default is 40. It is impossible to set it higher than 16384. that's the ceiling, don't test it πŸ’€
  • -C localmaxconn β€” Accept at most localmaxconn connections from the same IP address. Default is 40. It is impossible to set it higher than maxconn. so like, it's capped by the other cap, keep that in mind 🌈
ngl, those last two are giving "there's a limit and you will respect it" and honestly? valid.

🌼 ENVIRONMENT 🌼

for each connection, an instance of prog... is spawned with the following variables set β€” look at all these lil env besties πŸ“:

  • PROTO β€” Always set to TCP. always. no debate ✨
  • TCPLOCALIP β€” Set to the server socket's address. that's us πŸ’…
  • TCPLOCALPORT β€” Set to the server socket's port.
  • TCPREMOTEIP β€” Set to the client socket's address. that's them πŸ‘€
  • TCPREMOTEPORT β€” Set to the client socket's port.
  • TCPCONNNUM β€” Set to the number of connections originating from the same IP address. lowkey a whole headcount 🧚

πŸ”₯ SEE ALSO πŸ”₯

execve(2), s6-notifywhenup(7), s6-tcpclient(8), s6-tcpserver(8), s6-tcpserver-access(8), s6-tcpserver-socketbinder(8)

[1] https://cr.yp.to/ucspi-tcp/tcpserver.html

[2] https://cr.yp.to/proto/ucspi.txt

This man page is ported from the authoritative documentation at: https://skarnet.org/software/s6-networking/s6-tcpserverd.html


πŸ’œ AUTHORS πŸ’œ

  • Laurent Bercot
  • Alexis <flexibeast@gmail.com> (man page port) β€” thank you for the port, icon πŸŽ€

okay that's the whole page!! brought to you by the Debian crew, dated November 20, 2023, and rewritten with love by your fave unix bestie πŸ’–βœ¨ bye!! πŸ¦‹

πŸ“¦ where this page comes from