aboutsummaryrefslogtreecommitdiffstats
s6-networking: the s6-tcpserver6-socketbinder program

s6-networking
Software
skarnet.org

The s6-tcpserver6-socketbinder program

s6-tcpserver6-socketbinder binds an INET domain socket to an IPv6 address and port, then executes a program.

Interface

     s6-tcpserver6-socketbinder [ -d | -D ] [ -b backlog ] [ -M | -m ] [ -B ] ip port prog...
  • s6-tcpserver6-socketbinder creates an TCP socket and binds it to IPv6 address ip, port port. It prepares the socket to accept connections by calling listen().
  • It then execs into prog... with the open socket as its standard input.

Options

  • -d : allow instant rebinding to the same IP and port even if it has been used not long ago - this is the SO_REUSEADDR flag to setsockopt() and is generally used with server programs. This is the default.
  • -D : disallow instant rebinding to the same path.
  • -b backlog : set a maximum of backlog backlog connections on the socket - extra connection attempts will rejected by the kernel. The default is SOMAXCONN, i.e. the maximum number allowed by the system. If backlog is 0, then the socket will be created, but it will not be listening.
  • -M : create a TCP socket. This is the default.
  • -m : create a UDP socket. Note that by default UDP sockets are not connection-mode, and listen() will fail - so you should always give the -b0 option to s6-tcpserver6-socketbinder along with -m.
  • -B : create a blocking socket. Default is non-blocking.

Notes

  • The socket is provided non-blocking by default.
  • s6-tcpserver6-socketbinder is part of a set of basic blocks used to build a flexible TCP/IPv6 super-server. It normally should be given a command line crafted to make it execute into s6-tcpserver6d to accept connections from clients, or into a program such as s6-applyuidgid to drop privileges before doing so.
  • The s6-tcpserver6 program does exactly this. It implements a full TCP/IPv6 super-server by building a command line starting with s6-tcpserver6-socketbinder and ending with s6-tcpserver6d followed by the application program, and executing into it.