s6-networking
Software
skarnet.org
The s6-tcpserver4-socketbinder program
s6-tcpserver4-socketbinder binds an INET domain
socket to an IPv4 address and port, then executes a program.
Interface
s6-tcpserver4-socketbinder [ -d | -D ] [ -b backlog ] ip port prog...
- s6-tcpserver4-socketbinder creates an TCP socket
and binds it to IPv4 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.
Notes
- s6-tcpserver4-socketbinder is part of a set of basic blocks used to
build a flexible TCP/IPv4 super-server. It normally should be given a
command line crafted to make it execute into
s6-tcpserver4d to accept connections
from clients, or into a program such as
s6-applyuidgid
to drop privileges before doing so.
- The s6-tcpserver4 program does
exactly this. It implements
a full TCP/IPv4 super-server by building a command line starting with
s6-tcpserver4-socketbinder and ending with s6-tcpserver4d followed by the
application program, and executing into it.