The s6-tcpserver4-socketbinder program
s6-tcpserver4-socketbinder binds an INET domain
socket to an IPv4 address and port, then executes a program.
s6-tcpserver4-socketbinder [ -d | -D ] [ -b backlog ] [ -M | -m ] [ -B ] 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
- It then execs into prog... with the open socket
as its standard input.
- -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
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
- -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-tcpserver4-socketbinder along with -m.
- -B : create a blocking socket. Default is non-blocking.
- The socket is provided non-blocking by default.
- 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
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.