S6-TCPSERVER-SOCKETBINDER(8)

NAME
s6-tcpserver-socketbinder - bind an INET domain socket to an IPv4 or IPv6 address and port, then execute a program

SYNOPSIS
s6-tcpserver-socketbinder [-d | -D] [-b backlog] [-M | -m] [-B] ip port prog...

DESCRIPTION
s6-tcpserver-socketbinder creates a TCP socket and binds it to IP address ip, port port.

It prepares the socket to accept connections by calling listen(2).

It then exec(3) into prog... with the open socket as its standard input.

The socket is provided non-blocking by default.

s6-tcpserver-socketbinder is part of a set of basic blocks used to build a flexible TCP/IP super-server. It normally should be given a command line crafted to make it execute into s6-tcpserverd(8) to accept connections from clients, or into a program such as s6-applyuidgid(8) to drop privileges before doing so.

The s6-tcpserver(8) program does exactly this. It implements a full TCP/IP super-server by building a command line starting with s6-tcpserver-socketbinder and ending with s6-tcpserverd(8) followed by the application program, and executing into it.

For s6-tcpserver-socketbinder, ‘::’ means “all IPv6 addresses”, and ‘0.0.0.0’ means “all IPv4 addresses”. It does not provide a way to bind a socket to all addresses regardless of protocol; instead, you should use two sockets, one for IPv4 and one for IPv6.

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(2) 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 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(2) will fail — so you should always give the ‘b0’ option to s6-tcpserver-socketbinder along with -m.

-B  Create a blocking socket. Default is non-blocking.

SEE ALSO
listen(2), setsockopt(2), exec(3), s6-applyuidgid(8), s6-tcpserver(8), s6-tcpserverd(8)

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

AUTHORS
Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)