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