s6

Mirror/fork of https://skarnet.org/software/s6/
git clone https://ccx.te2000.cz/git/s6
Log | Files | Refs | README | LICENSE

s6-ioconnect.html (3672B)


      1 <html>
      2   <head>
      3     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      4     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      5     <meta http-equiv="Content-Language" content="en" />
      6     <title>s6: the s6-ioconnect program</title>
      7     <meta name="Description" content="s6: the s6-ioconnect program" />
      8     <meta name="Keywords" content="s6 ioconnect ucspi tcpconnect ipcconnect" />
      9     <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
     10   </head>
     11 <body>
     12 
     13 <p>
     14 <a href="index.html">s6</a><br />
     15 <a href="//skarnet.org/software/">Software</a><br />
     16 <a href="//skarnet.org/">skarnet.org</a>
     17 </p>
     18 
     19 <h1> The <tt>s6-ioconnect</tt> program </h1>
     20 
     21 <p>
     22 <tt>s6-ioconnect</tt> performs full-duplex data transmission
     23 between two sets of open file descriptors.
     24 </p>
     25 
     26 <h2> Interface </h2>
     27 
     28 <pre>
     29      s6-ioconnect [ -t <em>millisecs</em> ] [ -r <em>fdr</em> ] [ -w <em>fdw</em> ]
     30 </pre>
     31 
     32 <ul>
     33  <li> s6-ioconnect reads data from its stdin and writes it as is to
     34 file descriptor 7, which is assumed to be open. </li>
     35  <li> It also reads data from its file descriptor 6, which is assumed
     36 to be open, and writes it as is to its stdout. </li>
     37  <li> When both sides have transmitted EOF and s6-ioconnect has
     38 flushed its buffers, it exits 0. </li>
     39 </ul>
     40 
     41 <h2> Options </h2>
     42 
     43 <ul>
     44  <li> <tt>-t&nbsp;<em>millisecs</em></tt>&nbsp;: if no activity on
     45 either side happens for <em>millisecs</em> milliseconds, s6-ioconnect
     46 closes the connection on both ends and exits 1. By default,
     47 <em>millisecs</em> is 0, which means no such timeout. </li>
     48  <li> <tt>-r&nbsp;<em>fdr</em></tt>&nbsp;: Use fd <em>fdr</em> for
     49 "remote" reading instead of fd 6. </li>
     50  <li> <tt>-w&nbsp;<em>fdw</em></tt>&nbsp;: Use fd <em>fdw</em> for
     51 "remote" writing instead of fd 7. </li>
     52  <li> The <tt>-0</tt>, <tt>-1</tt>, <tt>-6</tt> and <tt>-7</tt> options
     53 are still recognized for compatibility, but do nothing; they are
     54 deprecated. They were previously used to tell
     55 s6-ioconnect that the local reading, local writing, remote reading and
     56 remote writing endpoints, respectively, were sockets &mdash; but this is
     57 now autodetected. </li>
     58 </ul>
     59 
     60 <h2> Notes </h2>
     61 
     62 <ul>
     63  <li> The point of s6-ioconnect is to be used together with
     64 <a href="//skarnet.org/software/s6-networking/s6-tcpclient.html">s6-tcpclient</a> or
     65 <a href="s6-ipcclient.html">s6-ipcclient</a> to establish a full-
     66 duplex connection between the client and the server, for instance
     67 for testing purposes. <tt>s6-ioconnect</tt> is to s6-tcpclient as
     68 <tt>cat</tt> is to s6-tcpserver: a program that will just echo
     69 what it gets. </li>
     70  <li> The s6-ioconnect utility was once part of the
     71 <a href="//skarnet.org/software/s6-networking/">s6-networking</a>
     72 suite, which is why the
     73 examples here involve TCP. Nevertheless, it can be used with connections
     74 across Unix domain sockets as well, and has its place in the s6
     75 package. </li>
     76  <li> If one of the endpoints is a socket, s6-ioconnect will call
     77 <a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html">shutdown()</a>
     78 on it (for reading or writing, depending on the endpoint) when it
     79 needs to transmit EOF. This is a necessary workaround to a
     80 <a href="https://cr.yp.to/tcpip/twofd.html">misdesign</a> of the
     81 socket API, but it could have unintended consequences
     82 when the socket is shared among several processes that expect a
     83 persistent connection. Most of the time, however, it is a mistake
     84 to share a data socket between processes, so s6-ioconnect's behaviour
     85 is suited to an overwhelming majority of cases, and the exceptions are
     86 specialized enough that they won't need to use s6-ioconnect. </li>
     87 </ul>
     88 
     89 </body>
     90 </html>