diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-09-30 05:40:04 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-09-30 05:40:04 +0000 |
commit | bef76b45f480aa41209efdec09fc6bb0bfde7cbe (patch) | |
tree | bb3945da0504c569ff325829bf5f895f8e355039 /doc/s6-tcpserver-socketbinder.html | |
parent | a068a3256fab3b77b7d1bc9ce201c954a9b00c94 (diff) | |
download | s6-networking-bef76b45f480aa41209efdec09fc6bb0bfde7cbe.tar.xz |
Great Tcpserver Unification. Prepare for 2.6.0.0.
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'doc/s6-tcpserver-socketbinder.html')
-rw-r--r-- | doc/s6-tcpserver-socketbinder.html | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/doc/s6-tcpserver-socketbinder.html b/doc/s6-tcpserver-socketbinder.html new file mode 100644 index 0000000..8e7135d --- /dev/null +++ b/doc/s6-tcpserver-socketbinder.html @@ -0,0 +1,86 @@ +<html> + <head> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <meta http-equiv="Content-Language" content="en" /> + <title>s6-networking: the s6-tcpserver-socketbinder program</title> + <meta name="Description" content="s6-networking: the s6-tcpserver-socketbinder program" /> + <meta name="Keywords" content="s6-networking s6-tcpserver-socketbinder tcpserver ucspi inet ipv4 ipv6 socket bind listen TCP/IP" /> + <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> --> + </head> +<body> + +<p> +<a href="index.html">s6-networking</a><br /> +<a href="//skarnet.org/software/">Software</a><br /> +<a href="//skarnet.org/">skarnet.org</a> +</p> + +<h1> The <tt>s6-tcpserver-socketbinder</tt> program </h1> + +<p> +<tt>s6-tcpserver-socketbinder</tt> binds an INET domain +socket to an IPv4 or IPv6 address and port, then executes a program. +</p> + +<h2> Interface </h2> + +<pre> + s6-tcpserver-socketbinder [ -d | -D ] [ -b <em>backlog</em> ] [ -M | -m ] [ -B ] <em>ip</em> <em>port</em> <em>prog...</em> +</pre> + +<ul> + <li> s6-tcpserver-socketbinder creates a TCP socket +and binds it to IP address <em>ip</em>, port <em>port</em>. +It prepares the socket to accept connections by calling +<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html">listen()</a>. </li> + <li> It then execs into <em>prog...</em> with the open socket +as its standard input. </li> +</ul> + +<h2> Options </h2> + +<ul> + <li> <tt>-d</tt> : 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 +<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html">setsockopt()</a> +and is generally used with server programs. This is the default. </li> + <li> <tt>-D</tt> : disallow instant rebinding to the same path. </li> + <li> <tt>-b <em>backlog</em></tt> : set a maximum of +<em>backlog</em> backlog connections on the socket - extra +connection attempts will rejected by the kernel. The default is the maximum +number allowed by the system. If <em>backlog</em> +is 0, then the socket will be created, but it <strong>will not be +listening</strong>. </li> + <li> <tt>-M</tt> : create a TCP socket. This is the default. </li> + <li> <tt>-m</tt> : create a UDP socket. Note +that by default UDP sockets are not connection-mode, and <tt>listen()</tt> +will fail - so you should always give the <tt>-b0</tt> option to +s6-tcpserver-socketbinder along with <tt>-m</tt>. </li> + <li> <tt>-B</tt> : create a blocking socket. Default is non-blocking. </li> +</ul> + +<h2> Notes </h2> + +<ul> + <li> The socket is provided <strong>non-blocking by default</strong>. </li> + <li> 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 +<a href="s6-tcpserverd.html">s6-tcpserverd</a> to accept connections +from clients, or into a program such as +<a href="//skarnet.org/software/s6/s6-applyuidgid.html">s6-applyuidgid</a> +to drop privileges before doing so. </li> + <li> The <a href="s6-tcpserver.html">s6-tcpserver</a> 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 followed by the +application program, and executing into it. </li> + <li> For s6-tcpserver-socketbinder, <tt>::</tt> means "all IPv6 addresses", +and <tt>0.0.0.0</tt> 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. </li> +</ul> + +</body> +</html> |