You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3627 lines
220 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html><head>
  2. <title>socat</title>
  3. <link rev="made" href="mailto:socat@dest-unreach.org">
  4. </head>
  5. <body>
  6. <hr>
  7. <h1><strong>socat</strong></h1>
  8. <p>
  9. <a name="CONTENTS"></a>
  10. <h2>CONTENTS</h2>
  11. <a href="socat.html#NAME">NAME</a><br>
  12. <a href="socat.html#SYNOPSIS">SYNOPSIS</a><br>
  13. <a href="socat.html#DESCRIPTION">DESCRIPTION</a><br>
  14. <a href="socat.html#OPTIONS">OPTIONS</a><br>
  15. <a href="socat.html#ADDRESS_SPECIFICATIONS">ADDRESS SPECIFICATIONS</a><br>
  16. <a href="socat.html#ADDRESS_TYPES">ADDRESS TYPES</a><br>
  17. <a href="socat.html#ADDRESS_OPTIONS">ADDRESS OPTIONS</a><br>
  18. <a href="socat.html#VALUES">DATA VALUES</a><br>
  19. <a href="socat.html#EXAMPLES">EXAMPLES</a><br>
  20. <a href="socat.html#DIAGNOSTICS">DIAGNOSTICS</a><br>
  21. <a href="socat.html#FILES">FILES</a><br>
  22. <a href="socat.html#ENVIRONMENT_VARIABLES">ENVIRONMENT VARIABLES</a><br>
  23. <a href="socat.html#CREDITS">CREDITS</a><br>
  24. <a href="socat.html#VERSION">VERSION</a><br>
  25. <a href="socat.html#BUGS">BUGS</a><br>
  26. <a href="socat.html#SEEALSO">SEE ALSO</a><br>
  27. <p>
  28. <a name="NAME"></a>
  29. <h2>NAME</h2>socat - Multipurpose relay (SOcket CAT)
  30. <p>
  31. <a name="SYNOPSIS"></a>
  32. <h2>SYNOPSIS</h2>
  33. <code>socat [options] &lt;address&gt; &lt;address&gt;</code><br>
  34. <code>socat -V</code><br>
  35. <code>socat -h[h[h]] | -?[?[?]]</code><br>
  36. <code>filan</code><br>
  37. <code>procan</code>
  38. <p>
  39. <a name="DESCRIPTION"></a>
  40. <h2>DESCRIPTION</h2>
  41. <p>
  42. <strong>Socat</strong> is a command line based utility that establishes two bidirectional byte
  43. streams and transfers data between them. Because the streams can be constructed
  44. from a large set of different types of data sinks and sources
  45. (see <a href="socat.html#ADDRESS_TYPES">address types</a>), and because lots of
  46. <a href="socat.html#ADDRESS_OPTIONS">address options</a> may be applied to the streams, socat can
  47. be used for many different purposes.
  48. <p>
  49. <strong>Filan</strong> is a utility that prints information about its active file
  50. descriptors to stdout. It has been written for debugging <strong>socat</strong>, but might be
  51. useful for other purposes too. Use the -h option to find more infos.
  52. <p>
  53. <strong>Procan</strong> is a utility that prints information about process parameters to
  54. stdout. It has been written to better understand
  55. some UNIX process properties and for debugging <strong>socat</strong>, but might be
  56. useful for other purposes too.
  57. <p>
  58. The life cycle of a <strong>socat</strong> instance typically consists of four phases.
  59. <p>
  60. In the <em>init</em> phase, the command line options are parsed and logging is
  61. initialized.
  62. <p>
  63. During the <em>open</em> phase, <strong>socat</strong> opens the first address and afterwards the
  64. second address. These steps are usually blocking; thus, especially for complex address types like socks,
  65. connection requests or authentication dialogs must be completed before the next
  66. step is started.
  67. <p>
  68. In the <em>transfer</em> phase, <strong>socat</strong> watches both streams' read and write file
  69. descriptors via
  70. <code>select()</code>
  71. , and, when data is available on one side <em>and</em>
  72. can be written to the other side, socat reads it, performs newline
  73. character conversions if required, and writes the data to the write file
  74. descriptor of the other stream, then continues waiting for more data in both
  75. directions.
  76. <p>
  77. When one of the streams effectively reaches EOF, the <em>closing</em> phase
  78. begins. <strong>Socat</strong> transfers the EOF condition to the other stream,
  79. i.e. tries to shutdown only its write stream, giving it a chance to
  80. terminate gracefully. For a defined time <strong>socat</strong> continues to transfer data in
  81. the other direction, but then closes all remaining channels and terminates.
  82. <p>
  83. <a name="OPTIONS"></a>
  84. <h2>OPTIONS</h2>
  85. <p>
  86. <strong>Socat</strong> provides some command line options that modify the behaviour of the
  87. program. They have nothing to do with so called
  88. <a href="socat.html#ADDRESS_OPTIONS">address options</a> that are used as parts of <a href="socat.html#ADDRESS_SPECIFICATIONS">address specifications</a>.
  89. <p>
  90. <dl>
  91. <p><dt><strong><strong><code>-V</code></strong></strong><dd>
  92. Print version and available feature information to stdout, and exit.
  93. <p><dt><strong><strong><code>-h | -?</code></strong></strong><dd>
  94. Print a help text to stdout describing command line options and available address
  95. types, and exit.
  96. <p><dt><strong><strong><code>-hh | -??</code></strong></strong><dd>
  97. Like -h, plus a list of the short names of all available address options. Some options are
  98. platform dependend, so this output is helpful for checking the particular
  99. implementation.
  100. <p><dt><strong><strong><code>-hhh | -???</code></strong></strong><dd>
  101. Like -hh, plus a list of all available address option names.
  102. <a name="option_d"></a><p><dt><strong><strong><code>-d</code></strong></strong><dd>
  103. Without this option, only fatal and error messages are generated; applying
  104. this option also prints warning messages. See <a href="socat.html#DIAGNOSTICS">DIAGNOSTICS</a>
  105. for more information.
  106. <a name="option_d_d"></a><p><dt><strong><strong><code>-d -d</code></strong></strong><dd> Prints fatal, error, warning, and notice messages.
  107. <p><dt><strong><strong><code>-d -d -d</code></strong></strong><dd> Prints fatal, error, warning, notice, and info messages.
  108. <p><dt><strong><strong><code>-d -d -d -d</code></strong></strong><dd> Prints fatal, error, warning, notice, info, and debug
  109. messages.
  110. <p><dt><strong><strong><code>-D</code></strong></strong><dd>
  111. Logs information about file descriptors before starting the transfer phase.
  112. <p><dt><strong><strong><code>-ly[&lt;facility&gt;]</code></strong></strong><dd>
  113. Writes messages to syslog instead of stderr; severity as defined with -d
  114. option. With optional <a href="socat.html#TYPE_FACILITY">&lt;facility&gt;</a>, the syslog type can
  115. be selected, default is "daemon". Third party libraries might not obey this
  116. option.
  117. <p><dt><strong><strong><code>-lf</code></strong><code> &lt;logfile&gt;</code></strong><dd>
  118. Writes messages to &lt;logfile&gt; [<a href="socat.html#TYPE_FILENAME">filename</a>] instead of
  119. stderr. Some third party libraries, in particular libwrap, might not obey
  120. this option.
  121. <p><dt><strong><strong><code>-ls</code></strong></strong><dd>
  122. Writes messages to stderr (this is the default). Some third party libraries
  123. might not obey this option, in particular libwrap appears to only log to
  124. syslog.
  125. <a name="option_lp"></a><p><dt><strong><strong><code>-lp</code></strong><code>&lt;progname&gt;</code></strong><dd>
  126. Overrides the program name printed in error messages and used for
  127. constructing environment variable names.
  128. <p><dt><strong><strong><code>-lu</code></strong></strong><dd>
  129. Extends the timestamp of error messages to microsecond resolution. Does not
  130. work when logging to syslog.
  131. <a name="option_lm"></a><p><dt><strong><strong><code>-lm[&lt;facility&gt;]</code></strong></strong><dd>
  132. Mixed log mode. During startup messages are printed to stderr; when <strong>socat</strong>
  133. starts the transfer phase loop or daemon mode (i.e. after opening all
  134. streams and before starting data transfer, or, with listening sockets with
  135. fork option, before the first accept call), it switches logging to syslog.
  136. With optional <a href="socat.html#TYPE_FACILITY">&lt;facility&gt;</a>, the syslog type can be
  137. selected, default is "daemon".
  138. <a name="option_lh"></a><p><dt><strong><strong><code>-lh</code></strong></strong><dd>
  139. Adds hostname to log messages. Uses the value from environment variable
  140. HOSTNAME or the value retrieved with <code>uname()</code> if HOSTNAME is not set.
  141. <p><dt><strong><strong><code>-v</code></strong></strong><dd>
  142. Writes the transferred data not only to their target streams, but also to
  143. stderr. The output format is text with some conversions for readability, and
  144. prefixed with "&gt; " or "&lt; " indicating flow directions.
  145. <p><dt><strong><strong><code>-x</code></strong></strong><dd>
  146. Writes the transferred data not only to their target streams, but also to
  147. stderr. The output format is hexadecimal, prefixed with "&gt; " or "&lt; "
  148. indicating flow directions. Can be combined with
  149. <code>-v</code>
  150. .
  151. <a name="option_b"></a><p><dt><strong><strong><code>-b</code></strong><code>&lt;size&gt;</code></strong><dd>
  152. Sets the data transfer block &lt;size&gt; [<a href="socat.html#TYPE_SIZE_T">size_t</a>].
  153. At most &lt;size&gt; bytes are transferred per step. Default is 8192 bytes.
  154. <a name="option_s"></a><p><dt><strong><strong><code>-s</code></strong></strong><dd>
  155. By default, <strong>socat</strong> terminates when an error occurred to prevent the process
  156. from running when some option could not be applied. With this
  157. option, <strong>socat</strong> is sloppy with errors and tries to continue. Even with this
  158. option, socat will exit on fatals, and will abort connection attempts when
  159. security checks failed.
  160. <a name="option_t"></a><p><dt><strong><strong><code>-t</code></strong><code>&lt;timeout&gt;</code></strong><dd>
  161. When one channel has reached EOF, the write part of the other channel is shut
  162. down. Then, <strong>socat</strong> waits &lt;timeout&gt; [<a href="socat.html#TYPE_TIMEVAL">timeval</a>] seconds
  163. before terminating. Default is 0.5 seconds. This timeout only applies to
  164. addresses where write and read part can be closed independently. When during
  165. the timeout interval the read part gives EOF, socat terminates without
  166. awaiting the timeout.
  167. <a name="option_T"></a><p><dt><strong><strong><code>-T</code></strong><code>&lt;timeout&gt;</code></strong><dd>
  168. Total inactivity timeout: when socat is already in the transfer loop and
  169. nothing has happened for &lt;timeout&gt; [<a href="socat.html#TYPE_TIMEVAL">timeval</a>] seconds
  170. (no data arrived, no interrupt occurred...) then it terminates.
  171. Useful with protocols like UDP that cannot transfer EOF.
  172. <a name="option_u"></a><p><dt><strong><strong><code>-u</code></strong></strong><dd>
  173. Uses unidirectional mode. The first address is only used for reading, and the
  174. second address is only used for writing (<a href="socat.html#EXAMPLE_option_u">example</a>).
  175. <a name="option_U"></a><p><dt><strong><strong><code>-U</code></strong></strong><dd>
  176. Uses unidirectional mode in reverse direction. The first address is only
  177. used for writing, and the second address is only used for reading.
  178. <a name="option_g"></a><p><dt><strong><strong><code>-g</code></strong></strong><dd>
  179. During address option parsing, don't check if the option is considered
  180. useful in the given address environment. Use it if you want to force, e.g.,
  181. appliance of a socket option to a serial device.
  182. <a name="option_L"></a><p><dt><strong><strong><code>-L</code></strong><code>&lt;lockfile&gt;</code></strong><dd>
  183. If lockfile exists, exits with error. If lockfile does not exist, creates it
  184. and continues, unlinks lockfile on exit.
  185. <a name="option_W"></a><p><dt><strong><strong><code>-W</code></strong><code>&lt;lockfile&gt;</code></strong><dd>
  186. If lockfile exists, waits until it disappears. When lockfile does not exist,
  187. creates it and continues, unlinks lockfile on exit.
  188. <a name="option_4"></a><p><dt><strong><strong><code>-4</code></strong></strong><dd>
  189. Use IP version 4 in case that the addresses do not implicitly or explicitly
  190. specify a version; this is the default.
  191. <a name="option_6"></a><p><dt><strong><strong><code>-6</code></strong></strong><dd>
  192. Use IP version 6 in case that the addresses do not implicitly or explicitly
  193. specify a version.
  194. </dl>
  195. <p>
  196. <a name="ADDRESS_SPECIFICATIONS"></a>
  197. <h2>ADDRESS SPECIFICATIONS</h2>
  198. <p>
  199. With the address command line arguments, the user gives <strong>socat</strong> instructions and
  200. the necessary information for establishing the byte streams.
  201. <p>
  202. An address specification usually consists of an address type
  203. keyword, zero or more required address parameters separated by ':' from the keyword and
  204. from each
  205. other, and zero or more address options separated by ','.
  206. <p>
  207. The keyword specifies the address type (e.g., TCP4, OPEN, EXEC). For some
  208. keywords there exist synonyms ('-' for STDIO, TCP for TCP4). Keywords are case
  209. insensitive.
  210. For a few special address types, the keyword may be omitted:
  211. Address specifications starting with a number are assumed to be FD (raw file
  212. descriptor) addresses;
  213. if a '/' is found before the first ':' or ',', GOPEN (generic file open) is
  214. assumed.
  215. <p>
  216. The required number and type of address parameters depend on the address
  217. type. E.g., TCP4 requires a server specification (name or address), and a port
  218. specification (number or service name).
  219. <p>
  220. Zero or more address options may be given with each address. They influence the
  221. address in some ways.
  222. Options consist of an option keyword or an option keyword and a value,
  223. separated by '='. Option keywords are case insensitive.
  224. For filtering the options that are useful with an address
  225. type, each option is member of one option group. For
  226. each address type there is a set of option groups allowed. Only options
  227. belonging to one of these address groups may be used (except with <a href="socat.html#option_g">option -g</a>).
  228. <p>
  229. <a name="ADDRESS_DUAL"></a>
  230. Address specifications following the above schema are also called <em>single</em>
  231. address specifications.
  232. Two single addresses can be combined with "!!" to form a <em>dual</em> type
  233. address for one channel. Here, the first address is used by <strong>socat</strong> for reading
  234. data, and the
  235. second address for writing data. There is no way to specify an option only once
  236. for being applied to both single addresses.
  237. <p>
  238. Usually, addresses are opened in read/write
  239. mode. When an address is part of a dual address specification, or when
  240. <a href="socat.html#option_u">option -u</a> or <a href="socat.html#option_U">-U</a> is used, an address might be
  241. used only for reading or for writing. Considering this is important with some
  242. address types.
  243. <p>
  244. With socat version 1.5.0 and higher, the lexical analysis tries to handle
  245. quotes and parenthesis meaningfully and allows escaping of special characters.
  246. If one of the characters ( { [ ' is found, the corresponding closing
  247. character - ) } ] ' - is looked for; they may also be nested. Within these
  248. constructs, socats special characters and strings : , !! are not handled
  249. specially. All those characters and strings can be escaped with \ or within ""
  250. <p>
  251. <a name="ADDRESS_TYPES"></a>
  252. <h2>ADDRESS TYPES</h2>
  253. <p>
  254. This section describes the available address types with their keywords,
  255. parameters, and semantics.
  256. <p>
  257. <dl>
  258. <a name="ADDRESS_CREAT"></a><p><dt><strong><strong><code>CREATE:&lt;filename&gt;</code></strong></strong><dd>
  259. Opens <a href="socat.html#TYPE_FILENAME">&lt;filename&gt;</a> with
  260. <code>creat()</code>
  261. and uses the file
  262. descriptor for writing.
  263. This address type requires write-only context, because a file opened with
  264. <code>creat</code>
  265. cannot be read from. <br>
  266. Flags like O_LARGEFILE cannot be applied. If you need them use
  267. <a href="socat.html#ADDRESS_OPEN">OPEN</a> with options
  268. <a href="socat.html#OPTION_O_CREAT">create</a>,<a href="socat.html#OPTION_O_TRUNC">create</a>. <br>
  269. &lt;filename&gt; must be a valid existing or not existing path.
  270. If &lt;filename&gt; is a named pipe,
  271. <code>creat()</code>
  272. might block;
  273. if &lt;filename&gt; refers to a socket, this is an error.<br>
  274. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_REG">REG</a>,<a href="socat.html#GROUP_NAMED">NAMED</a> <br>
  275. Useful options:
  276. <a href="socat.html#OPTION_MODE">mode</a>,
  277. <a href="socat.html#OPTION_USER">user</a>,
  278. <a href="socat.html#OPTION_GROUP">group</a>,
  279. <a href="socat.html#OPTION_UNLINK_EARLY">unlink-early</a>,
  280. <a href="socat.html#OPTION_UNLINK_LATE">unlink-late</a>,
  281. <a href="socat.html#OPTION_APPEND">append</a><br>
  282. See also: <a href="socat.html#ADDRESS_OPEN">OPEN</a>, <a href="socat.html#ADDRESS_GOPEN">GOPEN</a>
  283. <a name="ADDRESS_EXEC"></a><p><dt><strong><strong><code>EXEC:&lt;command-line&gt;</code></strong></strong><dd>
  284. Forks a sub process that establishes communication with its parent process
  285. and invokes the specified program with
  286. <code>execvp()</code>
  287. .
  288. <a href="socat.html#TYPE_COMMAND_LINE">&lt;command-line&gt;</a> is a simple command
  289. with arguments separated by single spaces. If the program name
  290. contains a '/', the part after the last '/' is taken as ARGV[0]. If the
  291. program name is a relative
  292. path, the
  293. <code>execvp()</code>
  294. semantics for finding the program via
  295. <code>$PATH</code>
  296. apply. After successful program start, <strong>socat</strong> writes data to stdin of the
  297. process and reads from its stdout using a UNIX domain socket generated by
  298. <code>socketpair()</code>
  299. per default. (<a href="socat.html#EXAMPLE_ADDRESS_EXEC">example</a>) <br>
  300. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_EXEC">EXEC</a>,<a href="socat.html#GROUP_FORK">FORK</a>,<a href="socat.html#GROUP_TERMIOS">TERMIOS</a> <br>
  301. Useful options:
  302. <a href="socat.html#OPTION_PATH">path</a>,
  303. <a href="socat.html#OPTION_FDIN">fdin</a>,
  304. <a href="socat.html#OPTION_FDOUT">fdout</a>,
  305. <a href="socat.html#OPTION_CHROOT">chroot</a>,
  306. <a href="socat.html#OPTION_SUBSTUSER">su</a>,
  307. <a href="socat.html#OPTION_SUBSTUSER_DELAYED">su-d</a>,
  308. <a href="socat.html#OPTION_NOFORK">nofork</a>,
  309. <a href="socat.html#OPTION_PTY">pty</a>,
  310. <a href="socat.html#OPTION_STDERR">stderr</a>,
  311. <a href="socat.html#OPTION_CTTY">ctty</a>,
  312. <a href="socat.html#OPTION_SETSID">setsid</a>,
  313. <a href="socat.html#OPTION_PIPES">pipes</a>,
  314. <a href="socat.html#OPTION_LOGIN">login</a>,
  315. <a href="socat.html#OPTION_SIGINT">sigint</a>,
  316. <a href="socat.html#OPTION_SIGQUIT">sigquit</a><br>
  317. See also: <a href="socat.html#ADDRESS_SYSTEM">SYSTEM</a>
  318. <a name="ADDRESS_FD"></a><p><dt><strong><strong><code>FD:&lt;fdnum&gt;</code></strong></strong><dd>
  319. Uses the file descriptor <a href="socat.html#TYPE_FDNUM">&lt;fdnum&gt;</a>. It must already exist as
  320. valid UN*X file descriptor.<br>
  321. Option groups: <a href="socat.html#GROUP_FD">FD</a> (<a href="socat.html#GROUP_TERMIOS">TERMIOS</a>,<a href="socat.html#GROUP_REG">REG</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>) <br>
  322. See also:
  323. <a href="socat.html#ADDRESS_STDIO">STDIO</a>,
  324. <a href="socat.html#ADDRESS_STDIN">STDIN</a>,
  325. <a href="socat.html#ADDRESS_STDOUT">STDOUT</a>,
  326. <a href="socat.html#ADDRESS_STDERR">STDERR</a>
  327. <a name="ADDRESS_GOPEN"></a><p><dt><strong><strong><code>GOPEN:&lt;filename&gt;</code></strong></strong><dd>
  328. (Generic open) This address type tries to handle any file system entry
  329. except directories usefully. <a href="socat.html#TYPE_FILENAME">&lt;filename&gt;</a> may be a
  330. relative or absolute path. If it already exists, its type is checked.
  331. In case of a UNIX domain socket, <strong>socat</strong> connects; if connecting fails,
  332. <strong>socat</strong> assumes a datagram socket and uses
  333. <code>sendto()</code>
  334. calls.
  335. If the entry is not a socket, <strong>socat</strong> opens it applying the
  336. <code>O_APPEND</code>
  337. flag.
  338. If it does not exist, it is opened with flag
  339. <code>O_CREAT</code>
  340. as a regular file (<a href="socat.html#EXAMPLE_ADDRESS_GOPEN">example</a>).<br>
  341. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_REG">REG</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_NAMED">NAMED</a>,<a href="socat.html#GROUP_OPEN">OPEN</a> <br>
  342. See also:
  343. <a href="socat.html#ADDRESS_OPEN">OPEN</a>,
  344. <a href="socat.html#ADDRESS_CREAT">CREATE</a>,
  345. <a href="socat.html#ADDRESS_UNIX_CONNECT">UNIX-CONNECT</a>
  346. <p>
  347. <a name="ADDRESS_IP_SENDTO"></a><p><dt><strong><strong><code>IP-SENDTO:&lt;host&gt;:&lt;protocol&gt;</code></strong></strong><dd>
  348. Opens a raw IP socket. Depending on host specification or option <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>, IP protocol version
  349. 4 or 6 is used. It uses <a href="socat.html#TYPE_PROTOCOL">&lt;protocol&gt;</a> to send packets
  350. to &lt;host&gt; [<a href="socat.html#TYPE_IP_ADDRESS">IP address</a>] and receives packets from
  351. host, ignores packets from other hosts.
  352. Protocol 255 uses the raw socket with the IP header being part of the
  353. data.<br>
  354. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a> <br>
  355. Useful options:
  356. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>,
  357. <a href="socat.html#OPTION_TTL">ttl</a> <br>
  358. See also:
  359. <a href="socat.html#ADDRESS_IP4_SENDTO">IP4-SENDTO</a>,
  360. <a href="socat.html#ADDRESS_IP6_SENDTO">IP6-SENDTO</a>,
  361. <a href="socat.html#ADDRESS_IP_RECVFROM">IP-RECVFROM</a>,
  362. <a href="socat.html#ADDRESS_IP_RECV">IP-RECV</a>,
  363. <a href="socat.html#ADDRESS_UDP_SENDTO">UDP-SENDTO</a>,
  364. <a href="socat.html#ADDRESS_UNIX_SENDTO">UNIX-SENDTO</a>
  365. <a name="ADDRESS_INTERFACE"></a><p><dt><strong><strong><code>INTERFACE:&lt;interface&gt;</code></strong></strong><dd>
  366. Communicates with a network connected on an interface using raw packets
  367. including link level data. <a href="socat.html#TYPE_INTERFACE">&lt;interface&gt;</a> is the name of
  368. the network interface. Currently only available on Linux.
  369. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a> <br>
  370. Useful options:
  371. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>,
  372. <a href="socat.html#OPTION_SO_TYPE">type</a><br>
  373. See also: <a href="socat.html#ADDRESS_IP_RECV">ip-recv</a>
  374. <a name="ADDRESS_IP4_SENDTO"></a><p><dt><strong><strong><code>IP4-SENDTO:&lt;host&gt;:&lt;protocol&gt;</code></strong></strong><dd>
  375. Like <a href="socat.html#ADDRESS_IP_SENDTO">IP-SENDTO</a>, but always uses IPv4.<br>
  376. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a> <br>
  377. <a name="ADDRESS_IP6_SENDTO"></a><p><dt><strong><strong><code>IP6-SENDTO:&lt;host&gt;:&lt;protocol&gt;</code></strong></strong><dd>
  378. Like <a href="socat.html#ADDRESS_IP_SENDTO">IP-SENDTO</a>, but always uses IPv6.<br>
  379. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP6">IP6</a> <br>
  380. <p>
  381. <a name="ADDRESS_IP_DATAGRAM"></a><p><dt><strong><strong><code>IP-DATAGRAM:&lt;address&gt;:&lt;protocol&gt;</code></strong></strong><dd>
  382. Sends outgoing data to the specified address which may in particular be a
  383. broadcast or multicast address. Packets arriving on the local socket are
  384. checked if their source addresses match
  385. <a href="socat.html#OPTION_RANGE">RANGE</a> or <a href="socat.html#OPTION_TCPWRAPPERS">TCPWRAP</a>
  386. options. This address type can for example be used for implementing
  387. symmetric or asymmetric broadcast or multicast communications.<br>
  388. Option groups: <a href="socat.html#GROUP_FD">FD</a>, <a href="socat.html#GROUP_SOCKET">SOCKET</a>,
  389. <a href="socat.html#GROUP_IP4">IP4</a>, <a href="socat.html#GROUP_IP6">IP6</a>, <a href="socat.html#GROUP_RANGE">RANGE</a> <br>
  390. Useful options:
  391. <a href="socat.html#OPTION_BIND">bind</a>,
  392. <a href="socat.html#OPTION_RANGE">range</a>,
  393. <a href="socat.html#OPTION_TCPWRAPPERS">tcpwrap</a>,
  394. <a href="socat.html#OPTION_SO_BROADCAST">broadcast</a>,
  395. <a href="socat.html#OPTION_IP_MULTICAST_LOOP">ip-multicast-loop</a>,
  396. <a href="socat.html#OPTION_IP_MULTICAST_TTL">ip-multicast-ttl</a>,
  397. <a href="socat.html#OPTION_IP_MULTICAST_IF">ip-multicast-if</a>,
  398. <a href="socat.html#OPTION_IP_ADD_MEMBERSHIP">ip-add-membership</a>,
  399. <a href="socat.html#OPTION_TTL">ttl</a>,
  400. <a href="socat.html#OPTION_TOS">tos</a>,
  401. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a><br>
  402. See also:
  403. <a href="socat.html#ADDRESS_IP4_DATAGRAM">IP4-DATAGRAM</a>,
  404. <a href="socat.html#ADDRESS_IP6_DATAGRAM">IP6-DATAGRAM</a>,
  405. <a href="socat.html#ADDRESS_IP_SENDTO">IP-SENDTO</a>,
  406. <a href="socat.html#ADDRESS_IP_RECVFROM">IP-RECVFROM</a>,
  407. <a href="socat.html#ADDRESS_IP_RECV">IP-RECV</a>,
  408. <a href="socat.html#ADDRESS_UDP_DATAGRAM">UDP-DATAGRAM</a>
  409. <a name="ADDRESS_IP4_DATAGRAM"></a><p><dt><strong><strong><code>IP4-DATAGRAM:&lt;host&gt;:&lt;protocol&gt;</code></strong></strong><dd>
  410. Like <a href="socat.html#ADDRESS_IP_DATAGRAM">IP-DATAGRAM</a>, but always uses IPv4.
  411. (<a href="socat.html#EXAMPLE_ADDRESS_IP4_BROADCAST_CLIENT">example</a>)<br>
  412. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_RANGE">RANGE</a> <br>
  413. <a name="ADDRESS_IP6_DATAGRAM"></a><p><dt><strong><strong><code>IP6-DATAGRAM:&lt;host&gt;:&lt;protocol&gt;</code></strong></strong><dd>
  414. Like <a href="socat.html#ADDRESS_IP_DATAGRAM">IP-DATAGRAM</a>, but always uses IPv6. Please
  415. note that IPv6 does not know broadcasts.<br>
  416. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_RANGE">RANGE</a> <br>
  417. <p>
  418. <a name="ADDRESS_IP_RECVFROM"></a><p><dt><strong><strong><code>IP-RECVFROM:&lt;protocol&gt;</code></strong></strong><dd>
  419. Opens a raw IP socket of <a href="socat.html#TYPE_PROTOCOL">&lt;protocol&gt;</a>. Depending on option <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>, IP protocol version
  420. 4 or 6 is used. It receives one packet from an unspecified peer and may send one or more answer packets to that peer.
  421. This mode is particularly useful with fork option where each arriving packet - from arbitrary peers - is handled by its own sub process.
  422. This allows a behaviour similar to typical UDP based servers like ntpd or
  423. named.<br>
  424. Please note that the reply packets might be fetched as incoming traffic when
  425. sender and receiver IP address are identical because there is no port number
  426. to distinguish the sockets.<br>
  427. This address works well with IP-SENDTO address peers (see above).
  428. Protocol 255 uses the raw socket with the IP header being part of the
  429. data.<br>
  430. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a> <br>
  431. Useful options:
  432. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>,
  433. <a href="socat.html#OPTION_FORK">fork</a>,
  434. <a href="socat.html#OPTION_RANGE">range</a>,
  435. <a href="socat.html#OPTION_TTL">ttl</a>,
  436. <a href="socat.html#OPTION_SO_BROADCAST">broadcast</a><br>
  437. See also:
  438. <a href="socat.html#ADDRESS_IP4_RECVFROM">IP4-RECVFROM</a>,
  439. <a href="socat.html#ADDRESS_IP6_RECVFROM">IP6-RECVFROM</a>,
  440. <a href="socat.html#ADDRESS_IP_SENDTO">IP-SENDTO</a>,
  441. <a href="socat.html#ADDRESS_IP_RECV">IP-RECV</a>,
  442. <a href="socat.html#ADDRESS_UDP_RECVFROM">UDP-RECVFROM</a>,
  443. <a href="socat.html#ADDRESS_UNIX_RECVFROM">UNIX-RECVFROM</a>
  444. <a name="ADDRESS_IP4_RECVFROM"></a><p><dt><strong><strong><code>IP4-RECVFROM:&lt;protocol&gt;</code></strong></strong><dd>
  445. Like <a href="socat.html#ADDRESS_IP_RECVFROM">IP-RECVFROM</a>, but always uses IPv4.<br>
  446. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a> <br>
  447. <a name="ADDRESS_IP6_RECVFROM"></a><p><dt><strong><strong><code>IP6-RECVFROM:&lt;protocol&gt;</code></strong></strong><dd>
  448. Like <a href="socat.html#ADDRESS_IP_RECVFROM">IP-RECVFROM</a>, but always uses IPv6.<br>
  449. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a> <br>
  450. <p>
  451. <a name="ADDRESS_IP_RECV"></a><p><dt><strong><strong><code>IP-RECV:&lt;protocol&gt;</code></strong></strong><dd>
  452. Opens a raw IP socket of <a href="socat.html#TYPE_PROTOCOL">&lt;protocol&gt;</a>. Depending on option <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>, IP protocol version
  453. 4 or 6 is used. It receives packets from multiple unspecified peers and merges the data.
  454. No replies are possible.
  455. It can be, e.g., addressed by socat IP-SENDTO address peers.
  456. Protocol 255 uses the raw socket with the IP header being part of the
  457. data.<br>
  458. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_RANGE">RANGE</a> <br>
  459. Useful options:
  460. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>,
  461. <a href="socat.html#OPTION_RANGE">range</a><br>
  462. See also:
  463. <a href="socat.html#ADDRESS_IP4_RECV">IP4-RECV</a>,
  464. <a href="socat.html#ADDRESS_IP6_RECV">IP6-RECV</a>,
  465. <a href="socat.html#ADDRESS_IP_SENDTO">IP-SENDTO</a>,
  466. <a href="socat.html#ADDRESS_IP_RECVFROM">IP-RECVFROM</a>,
  467. <a href="socat.html#ADDRESS_UDP_RECV">UDP-RECV</a>,
  468. <a href="socat.html#ADDRESS_UNIX_RECV">UNIX-RECV</a>
  469. <a name="ADDRESS_IP4_RECV"></a><p><dt><strong><strong><code>IP4-RECV:&lt;protocol&gt;</code></strong></strong><dd>
  470. Like <a href="socat.html#ADDRESS_IP_RECV">IP-RECV</a>, but always uses IPv4.<br>
  471. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_RANGE">RANGE</a> <br>
  472. <a name="ADDRESS_IP6_RECV"></a><p><dt><strong><strong><code>IP6-RECV:&lt;protocol&gt;</code></strong></strong><dd>
  473. Like <a href="socat.html#ADDRESS_IP_RECV">IP-RECV</a>, but always uses IPv6.<br>
  474. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_RANGE">RANGE</a> <br>
  475. <p>
  476. <a name="ADDRESS_OPEN"></a><p><dt><strong><strong><code>OPEN:&lt;filename&gt;</code></strong></strong><dd>
  477. Opens <a href="socat.html#TYPE_FILENAME">&lt;filename&gt;</a> using the
  478. <code>open()</code>
  479. system call
  480. (<a href="socat.html#EXAMPLE_ADDRESS_OPEN">example</a>).
  481. This operation fails on UNIX domain sockets. <br>
  482. Note: This address type is rarely useful in bidirectional mode.<br>
  483. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_REG">REG</a>,<a href="socat.html#GROUP_NAMED">NAMED</a>,<a href="socat.html#GROUP_OPEN">OPEN</a> <br>
  484. Useful options:
  485. <a href="socat.html#OPTION_O_CREAT">creat</a>,
  486. <a href="socat.html#OPTION_EXCL">excl</a>,
  487. <a href="socat.html#OPTION_O_NOATIME">noatime</a>,
  488. <a href="socat.html#OPTION_NOFOLLOW">nofollow</a>,
  489. <a href="socat.html#OPTION_APPEND">append</a>,
  490. <a href="socat.html#OPTION_RDONLY">rdonly</a>,
  491. <a href="socat.html#OPTION_WRONLY">wronly</a>,
  492. <a href="socat.html#OPTION_LOCK">lock</a>,
  493. <a href="socat.html#OPTION_READBYTES">readbytes</a>,
  494. <a href="socat.html#OPTION_IGNOREEOF">ignoreeof</a><br>
  495. See also:
  496. <a href="socat.html#ADDRESS_CREAT">CREATE</a>,
  497. <a href="socat.html#ADDRESS_GOPEN">GOPEN</a>,
  498. <a href="socat.html#ADDRESS_UNIX_CONNECT">UNIX-CONNECT</a>
  499. <a name="ADDRESS_OPENSSL_CONNECT"></a><p><dt><strong><strong><code>OPENSSL:&lt;host&gt;:&lt;port&gt;</code></strong></strong><dd>
  500. Tries to establish a SSL connection to &lt;port&gt; [<a href="socat.html#TYPE_TCP_SERVICE">TCP
  501. service</a>] on
  502. &lt;host&gt; [<a href="socat.html#TYPE_IP_ADDRESS">IP address</a>] using TCP/IP version 4 or 6
  503. depending on address specification, name resolution, or option
  504. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>.<br>
  505. NOTE: Up to version 1.7.2.4
  506. the server certificate was only checked for validity against the system
  507. certificate store or <a href="socat.html#OPTION_OPENSSL_CAFILE">cafile</a> or
  508. <a href="socat.html#OPTION_OPENSSL_CAPATH">capath</a>,
  509. but not for match with the server's name or its IP address.
  510. Since version 1.7.3.0 socat checks the peer certificate for match with the
  511. &lt;host&gt; parameter or the value of the
  512. <a href="socat.html#OPTION_OPENSSL_COMMONNAME">openssl-commonname</a> option.
  513. Socat tries to match it against the certificates subject commonName,
  514. and the certifications extension subjectAltName DNS names. Wildcards in the
  515. certificate are supported.<br>
  516. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_TCP">TCP</a>,<a href="socat.html#GROUP_OPENSSL">OPENSSL</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  517. Useful options:
  518. <a href="socat.html#OPTION_OPENSSL_CIPHERLIST">cipher</a>,
  519. <a href="socat.html#OPTION_OPENSSL_VERIFY">verify</a>,
  520. <a href="socat.html#OPTION_OPENSSL_COMMONNAME">commonname</a>,
  521. <a href="socat.html#OPTION_OPENSSL_CAFILE">cafile</a>,
  522. <a href="socat.html#OPTION_OPENSSL_CAPATH">capath</a>,
  523. <a href="socat.html#OPTION_OPENSSL_CERTIFICATE">certificate</a>,
  524. <a href="socat.html#OPTION_OPENSSL_KEY">key</a>,
  525. <a href="socat.html#OPTION_OPENSSL_COMPRESS">compress</a>,
  526. <a href="socat.html#OPTION_BIND">bind</a>,
  527. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>,
  528. <a href="socat.html#OPTION_CONNECT_TIMEOUT">connect-timeout</a>,
  529. <a href="socat.html#OPTION_SOURCEPORT">sourceport</a>,
  530. <a href="socat.html#OPTION_RETRY">retry</a><br>
  531. See also:
  532. <a href="socat.html#ADDRESS_OPENSSL_LISTEN">OPENSSL-LISTEN</a>,
  533. <a href="socat.html#ADDRESS_TCP_CONNECT">TCP</a>
  534. <a name="ADDRESS_OPENSSL_LISTEN"></a><p><dt><strong><strong><code>OPENSSL-LISTEN:&lt;port&gt;</code></strong></strong><dd>
  535. Listens on tcp &lt;port&gt; [<a href="socat.html#TYPE_TCP_SERVICE">TCP service</a>].
  536. The IP version is 4 or the one specified with
  537. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>. When a
  538. connection is accepted, this address behaves as SSL server.<br>
  539. Note: You probably want to use the <a href="socat.html#OPTION_OPENSSL_CERTIFICATE">certificate</a> option with this address.<br>
  540. NOTE: The client certificate is only checked for validity against
  541. <a href="socat.html#OPTION_OPENSSL_CAFILE">cafile</a> or <a href="socat.html#OPTION_OPENSSL_CAPATH">capath</a>,
  542. but not for match with the client's name or its IP address!<br>
  543. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_TCP">TCP</a>,<a href="socat.html#GROUP_LISTEN">LISTEN</a>,<a href="socat.html#GROUP_OPENSSL">OPENSSL</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  544. Useful options:
  545. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>,
  546. <a href="socat.html#OPTION_OPENSSL_CIPHERLIST">cipher</a>,
  547. <a href="socat.html#OPTION_OPENSSL_VERIFY">verify</a>,
  548. <a href="socat.html#OPTION_OPENSSL_COMMONNAME">commonname</a>,
  549. <a href="socat.html#OPTION_OPENSSL_CAFILE">cafile</a>,
  550. <a href="socat.html#OPTION_OPENSSL_CAPATH">capath</a>,
  551. <a href="socat.html#OPTION_OPENSSL_CERTIFICATE">certificate</a>,
  552. <a href="socat.html#OPTION_OPENSSL_KEY">key</a>,
  553. <a href="socat.html#OPTION_OPENSSL_COMPRESS">compress</a>,
  554. <a href="socat.html#OPTION_FORK">fork</a>,
  555. <a href="socat.html#OPTION_BIND">bind</a>,
  556. <a href="socat.html#OPTION_RANGE">range</a>,
  557. <a href="socat.html#OPTION_TCPWRAPPERS">tcpwrap</a>,
  558. <a href="socat.html#OPTION_SUBSTUSER">su</a>,
  559. <a href="socat.html#OPTION_REUSEADDR">reuseaddr</a>,
  560. <a href="socat.html#OPTION_RETRY">retry</a><br>
  561. See also:
  562. <a href="socat.html#ADDRESS_OPENSSL_CONNECT">OPENSSL</a>,
  563. <a href="socat.html#ADDRESS_TCP_LISTEN">TCP-LISTEN</a>
  564. <a name="ADDRESS_NAMED_PIPE"></a><p><dt><strong><strong><code>PIPE:&lt;filename&gt;</code></strong></strong><dd>
  565. If <a href="socat.html#TYPE_FILENAME">&lt;filename&gt;</a> already exists, it is opened.
  566. If it does not exist, a named pipe is created and opened. Beginning with
  567. socat version 1.4.3, the named pipe is removed when the address is closed
  568. (but see option <a href="socat.html#OPTION_UNLINK_CLOSE">unlink-close</a><br>
  569. Note: When a pipe is used for both reading and writing, it works
  570. as echo service.<br>
  571. Note: When a pipe is used for both reading and writing, and socat tries
  572. to write more bytes than the pipe can buffer (Linux 2.4: 2048 bytes), socat
  573. might block. Consider using socat option, e.g.,
  574. <code>-b 2048</code>
  575. <br>
  576. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_NAMED">NAMED</a>,<a href="socat.html#GROUP_OPEN">OPEN</a> <br>
  577. Useful options:
  578. <a href="socat.html#OPTION_RDONLY">rdonly</a>,
  579. <a href="socat.html#OPTION_NONBLOCK">nonblock</a>,
  580. <a href="socat.html#OPTION_GROUP">group</a>,
  581. <a href="socat.html#OPTION_USER">user</a>,
  582. <a href="socat.html#OPTION_MODE">mode</a>,
  583. <a href="socat.html#OPTION_UNLINK_EARLY">unlink-early</a><br>
  584. See also: <a href="socat.html#ADDRESS_UNNAMED_PIPE">unnamed pipe</a>
  585. <a name="ADDRESS_UNNAMED_PIPE"></a><p><dt><strong><strong><code>PIPE</code></strong></strong><dd>
  586. Creates an unnamed pipe and uses it for reading and writing. It works as an
  587. echo, because everything written
  588. to it appeares immediately as read data.<br>
  589. Note: When socat tries to write more bytes than the pipe can queue (Linux
  590. 2.4: 2048 bytes), socat might block. Consider, e.g., using
  591. option
  592. <code>-b 2048</code>
  593. <br>
  594. Option groups: <a href="socat.html#GROUP_FD">FD</a> <br>
  595. See also: <a href="socat.html#ADDRESS_NAMED_PIPE">named pipe</a>
  596. <a name="ADDRESS_PROXY_CONNECT"></a><p><dt><strong><strong><code>PROXY:&lt;proxy&gt;:&lt;hostname&gt;:&lt;port&gt;</code></strong></strong><dd>
  597. Connects to an HTTP proxy server on port 8080 using TCP/IP version 4 or 6
  598. depending on address specification, name resolution, or option
  599. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>, and sends a CONNECT
  600. request for hostname:port. If the proxy grants access and succeeds to
  601. connect to the target, data transfer between socat and the target can
  602. start. Note that the traffic need not be HTTP but can be an arbitrary
  603. protocol. <br>
  604. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_TCP">TCP</a>,<a href="socat.html#GROUP_HTTP">HTTP</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  605. Useful options:
  606. <a href="socat.html#OPTION_PROXYPORT">proxyport</a>,
  607. <a href="socat.html#OPTION_IGNORECR">ignorecr</a>,
  608. <a href="socat.html#OPTION_PROXY_AUTHORIZATION">proxyauth</a>,
  609. <a href="socat.html#OPTION_PROXY_RESOLVE">resolve</a>,
  610. <a href="socat.html#OPTION_CRNL">crnl</a>,
  611. <a href="socat.html#OPTION_BIND">bind</a>,
  612. <a href="socat.html#OPTION_CONNECT_TIMEOUT">connect-timeout</a>,
  613. <a href="socat.html#OPTION_MSS">mss</a>,
  614. <a href="socat.html#OPTION_SOURCEPORT">sourceport</a>,
  615. <a href="socat.html#OPTION_RETRY">retry</a> <br>
  616. See also: <a href="socat.html#ADDRESS_SOCKS4">SOCKS</a>, <a href="socat.html#ADDRESS_TCP_CONNECT">TCP</a>
  617. <a name="ADDRESS_PTY"></a><p><dt><strong><strong><code>PTY</code></strong></strong><dd>
  618. Generates a pseudo terminal (pty) and uses its master side. Another process
  619. may open the pty's slave side using it like a serial line or terminal.
  620. (<a href="socat.html#EXAMPLE_ADDRESS_PTY">example</a>). If
  621. both the ptmx and the openpty mechanisms are available, ptmx is used
  622. (POSIX).<br>
  623. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_NAMED">NAMED</a>,<a href="socat.html#GROUP_PTY">PTY</a>,<a href="socat.html#GROUP_TERMIOS">TERMIOS</a> <br>
  624. Useful options:
  625. <a href="socat.html#OPTION_SYMBOLIC_LINK">link</a>,
  626. <a href="socat.html#OPTION_OPENPTY">openpty</a>,
  627. <a href="socat.html#OPTION_PTY_WAIT_SLAVE">wait-slave</a>,
  628. <a href="socat.html#OPTION_MODE">mode</a>,
  629. <a href="socat.html#OPTION_USER">user</a>,
  630. <a href="socat.html#OPTION_GROUP">group</a><br>
  631. See also:
  632. <a href="socat.html#ADDRESS_UNIX_LISTEN">UNIX-LISTEN</a>,
  633. <a href="socat.html#ADDRESS_NAMED_PIPE">PIPE</a>,
  634. <a href="socat.html#ADDRESS_EXEC">EXEC</a>, <a href="socat.html#ADDRESS_SYSTEM">SYSTEM</a>
  635. <a name="ADDRESS_READLINE"></a><p><dt><strong><strong><code>READLINE</code></strong></strong><dd>
  636. Uses GNU readline and history on stdio to allow editing and reusing input
  637. lines (<a href="socat.html#EXAMPLE_ADDRESS_READLINE">example</a>). This requires the GNU readline and
  638. history libraries. Note that stdio should be a (pseudo) terminal device,
  639. otherwise readline does not seem to work.<br>
  640. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_READLINE">READLINE</a>,<a href="socat.html#GROUP_TERMIOS">TERMIOS</a> <br>
  641. Useful options:
  642. <a href="socat.html#OPTION_HISTORY">history</a>,
  643. <a href="socat.html#OPTION_NOECHO">noecho</a><br>
  644. See also:
  645. <a href="socat.html#ADDRESS_STDIO">STDIO</a>
  646. <a name="ADDRESS_SCTP_CONNECT"></a><p><dt><strong><strong><code>SCTP-CONNECT:&lt;host&gt;:&lt;port&gt;</code></strong></strong><dd>
  647. Establishes an SCTP stream connection to the specified &lt;host&gt; [<a href="socat.html#TYPE_IP_ADDRESS">IP
  648. address</a>] and &lt;port&gt; [<a href="socat.html#TYPE_TCP_SERVICE">TCP service</a>]
  649. using IP version 4 or 6 depending on address specification, name
  650. resolution, or option <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>.<br>
  651. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_SCTP">SCTP</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  652. Useful options:
  653. <a href="socat.html#OPTION_BIND">bind</a>,
  654. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>,
  655. <a href="socat.html#OPTION_CONNECT_TIMEOUT">connect-timeout</a>,
  656. <a href="socat.html#OPTION_TOS">tos</a>,
  657. <a href="socat.html#OPTION_MTUDISCOVER">mtudiscover</a>,
  658. <a href="socat.html#OPTION_SCTP_MAXSEG">sctp-maxseg</a>,
  659. <a href="socat.html#OPTION_SCTP_NODELAY">sctp-nodelay</a>,
  660. <a href="socat.html#OPTION_NONBLOCK">nonblock</a>,
  661. <a href="socat.html#OPTION_SOURCEPORT">sourceport</a>,
  662. <a href="socat.html#OPTION_RETRY">retry</a>,
  663. <a href="socat.html#OPTION_READBYTES">readbytes</a><br>
  664. See also:
  665. <a href="socat.html#ADDRESS_SCTP4_CONNECT">SCTP4-CONNECT</a>,
  666. <a href="socat.html#ADDRESS_SCTP6_CONNECT">SCTP6-CONNECT</a>,
  667. <a href="socat.html#ADDRESS_SCTP_LISTEN">SCTP-LISTEN</a>,
  668. <a href="socat.html#ADDRESS_TCP_CONNECT">TCP-CONNECT</a>
  669. <a name="ADDRESS_SCTP4_CONNECT"></a><p><dt><strong><strong><code>SCTP4-CONNECT:&lt;host&gt;:&lt;port&gt;</code></strong></strong><dd>
  670. Like <a href="socat.html#ADDRESS_SCTP_CONNECT">SCTP-CONNECT</a>, but only supports IPv4 protocol.<br>
  671. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_SCTP">SCTP</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  672. <a name="ADDRESS_SCTP6_CONNECT"></a><p><dt><strong><strong><code>SCTP6-CONNECT:&lt;host&gt;:&lt;port&gt;</code></strong></strong><dd>
  673. Like <a href="socat.html#ADDRESS_SCTP_CONNECT">SCTP-CONNECT</a>, but only supports IPv6 protocol.<br>
  674. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_SCTP">SCTP</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  675. <a name="ADDRESS_SCTP_LISTEN"></a><p><dt><strong><strong><code>SCTP-LISTEN:&lt;port&gt;</code></strong></strong><dd>
  676. Listens on &lt;port&gt; [<a href="socat.html#TYPE_TCP_SERVICE">TCP service</a>] and accepts an
  677. SCTP connection. The IP version is 4 or the one specified with
  678. address option <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>, socat option
  679. (<a href="socat.html#option_4">-4</a>, <a href="socat.html#option_6">-6</a>), or environment variable <a href="socat.html#ENV_SOCAT_DEFAULT_LISTEN_IP">SOCAT_DEFAULT_LISTEN_IP</a>.
  680. Note that opening
  681. this address usually blocks until a client connects.<br>
  682. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_LISTEN">LISTEN</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_SCTP">SCTP</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  683. Useful options:
  684. <a href="socat.html#OPTION_CRNL">crnl</a>,
  685. <a href="socat.html#OPTION_FORK">fork</a>,
  686. <a href="socat.html#OPTION_BIND">bind</a>,
  687. <a href="socat.html#OPTION_RANGE">range</a>,
  688. <a href="socat.html#OPTION_TCPWRAPPERS">tcpwrap</a>,
  689. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>,
  690. <a href="socat.html#OPTION_MAX_CHILDREN">max-children</a>,
  691. <a href="socat.html#OPTION_BACKLOG">backlog</a>,
  692. <a href="socat.html#OPTION_SCTP_MAXSEG">sctp-maxseg</a>,
  693. <a href="socat.html#OPTION_SCTP_NODELAY">sctp-nodelay</a>,
  694. <a href="socat.html#OPTION_SUBSTUSER">su</a>,
  695. <a href="socat.html#OPTION_REUSEADDR">reuseaddr</a>,
  696. <a href="socat.html#OPTION_RETRY">retry</a>,
  697. <a href="socat.html#OPTION_COOL_WRITE">cool-write</a><br>
  698. See also:
  699. <a href="socat.html#ADDRESS_SCTP4_LISTEN">SCTP4-LISTEN</a>,
  700. <a href="socat.html#ADDRESS_SCTP6_LISTEN">SCTP6-LISTEN</a>,
  701. <a href="socat.html#ADDRESS_TCP_LISTEN">TCP-LISTEN</a>,
  702. <a href="socat.html#ADDRESS_SCTP_CONNECT">SCTP-CONNECT</a>
  703. <a name="ADDRESS_SCTP4_LISTEN"></a><p><dt><strong><strong><code>SCTP4-LISTEN:&lt;port&gt;</code></strong></strong><dd>
  704. Like <a href="socat.html#ADDRESS_SCTP_LISTEN">SCTP-LISTEN</a>, but only supports IPv4
  705. protocol.<br>
  706. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_LISTEN">LISTEN</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_SCTP">SCTP</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  707. <a name="ADDRESS_SCTP6_LISTEN"></a><p><dt><strong><strong><code>SCTP6-LISTEN:&lt;port&gt;</code></strong></strong><dd>
  708. Like <a href="socat.html#ADDRESS_SCTP_LISTEN">SCTP-LISTEN</a>, but only supports IPv6
  709. protocol.<br>
  710. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_LISTEN">LISTEN</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_SCTP">SCTP</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  711. <a name="ADDRESS_SOCKET_CONNECT"></a><p><dt><strong><strong><code>SOCKET-CONNECT:&lt;domain&gt;:&lt;protocol&gt;:&lt;remote-address&gt;</code></strong></strong><dd>
  712. Creates a stream socket using the first and second given socket parameters
  713. and <code>SOCK_STREAM</code> (see man socket(2)) and connects to the remote-address.
  714. The two socket parameters have to be specified by <a href="socat.html#TYPE_INT">int</a>
  715. numbers. Consult your OS documentation and include files to find the
  716. appropriate values. The remote-address must be the <a href="socat.html#TYPE_DATA">data</a>
  717. representation of a sockaddr structure without sa_family and (BSD) sa_len
  718. components.<br>
  719. Please note that you can - beyond the options of the specified groups - also
  720. use options of higher level protocols when you apply socat option
  721. <a href="socat.html#option_g">-g</a>.<br>
  722. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RETRY">RETRY</a><br>
  723. Useful options:
  724. <a href="socat.html#OPTION_BIND">bind</a>,
  725. <a href="socat.html#OPTION_SETSOCKOPT_INT">setsockopt-int</a>,
  726. <a href="socat.html#OPTION_SETSOCKOPT_BIN">setsockopt-bin</a>,
  727. <a href="socat.html#OPTION_SETSOCKOPT_STRING">setsockopt-string</a>
  728. <br>
  729. See also:
  730. <a href="socat.html#ADDRESS_TCP_CONNECT">TCP</a>,
  731. <a href="socat.html#ADDRESS_UDP_CONNECT">UDP-CONNECT</a>,
  732. <a href="socat.html#ADDRESS_UNIX_CONNECT">UNIX-CONNECT</a>,
  733. <a href="socat.html#ADDRESS_SOCKET_LISTEN">SOCKET-LISTEN</a>,
  734. <a href="socat.html#ADDRESS_SOCKET_SENDTO">SOCKET-SENDTO</a>
  735. <a name="ADDRESS_SOCKET_DATAGRAM"></a><p><dt><strong><strong><code>SOCKET-DATAGRAM:&lt;domain&gt;:&lt;type&gt;:&lt;protocol&gt;:&lt;remote-address&gt;</code></strong></strong><dd>
  736. Creates a datagram socket using the first three given socket parameters (see
  737. man socket(2)) and sends outgoing data to the remote-address. The three
  738. socket parameters have to be specified by <a href="socat.html#TYPE_INT">int</a>
  739. numbers. Consult your OS documentation and include files to find the
  740. appropriate values. The remote-address must be the <a href="socat.html#TYPE_DATA">data</a>
  741. representation of a sockaddr structure without sa_family and (BSD) sa_len
  742. components.<br>
  743. Please note that you can - beyond the options of the specified groups - also
  744. use options of higher level protocols when you apply socat option
  745. <a href="socat.html#option_g">-g</a>.<br>
  746. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_RANGE">RANGE</a><br>
  747. Useful options:
  748. <a href="socat.html#OPTION_BIND">bind</a>,
  749. <a href="socat.html#OPTION_RANGE">range</a>,
  750. <a href="socat.html#OPTION_SETSOCKOPT_INT">setsockopt-int</a>,
  751. <a href="socat.html#OPTION_SETSOCKOPT_BIN">setsockopt-bin</a>,
  752. <a href="socat.html#OPTION_SETSOCKOPT_STRING">setsockopt-string</a>
  753. <br>
  754. See also:
  755. <a href="socat.html#ADDRESS_UDP_DATAGRAM">UDP-DATAGRAM</a>,
  756. <a href="socat.html#ADDRESS_IP_DATAGRAM">IP-DATAGRAM</a>,
  757. <a href="socat.html#ADDRESS_SOCKET_SENDTO">SOCKET-SENDTO</a>,
  758. <a href="socat.html#ADDRESS_SOCKET_RECV">SOCKET-RECV</a>,
  759. <a href="socat.html#ADDRESS_SOCKET_RECVFROM">SOCKET-RECVFROM</a>
  760. <a name="ADDRESS_SOCKET_LISTEN"></a><p><dt><strong><strong><code>SOCKET-LISTEN:&lt;domain&gt;:&lt;protocol&gt;:&lt;local-address&gt;</code></strong></strong><dd>
  761. Creates a stream socket using the first and second given socket parameters
  762. and <code>SOCK_STREAM</code> (see man socket(2)) and waits for incoming connections
  763. on local-address. The two socket parameters have to be specified by
  764. <a href="socat.html#TYPE_INT">int</a> numbers. Consult your OS documentation and include files
  765. to find the appropriate values. The local-address must be the
  766. <a href="socat.html#TYPE_DATA">data</a> representation of a sockaddr structure without
  767. sa_family and (BSD) sa_len components.<br>
  768. Please note that you can - beyond the options of the specified groups - also
  769. use options of higher level protocols when you apply socat option
  770. <a href="socat.html#option_g">-g</a>.<br>
  771. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_LISTEN">LISTEN</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RETRY">RETRY</a><br>
  772. Useful options:
  773. <a href="socat.html#OPTION_SETSOCKOPT_INT">setsockopt-int</a>,
  774. <a href="socat.html#OPTION_SETSOCKOPT_BIN">setsockopt-bin</a>,
  775. <a href="socat.html#OPTION_SETSOCKOPT_STRING">setsockopt-string</a>
  776. <br>
  777. See also:
  778. <a href="socat.html#ADDRESS_TCP_LISTEN">TCP</a>,
  779. <a href="socat.html#ADDRESS_UDP_LISTEN">UDP-CONNECT</a>,
  780. <a href="socat.html#ADDRESS_UNIX_LISTEN">UNIX-CONNECT</a>,
  781. <a href="socat.html#ADDRESS_SOCKET_CONNECT">SOCKET-LISTEN</a>,
  782. <a href="socat.html#ADDRESS_SOCKET_RECVFROM">SOCKET-SENDTO</a>,
  783. <a href="socat.html#ADDRESS_SOCKET_RECV">SOCKET-SENDTO</a>
  784. <a name="ADDRESS_SOCKET_RECV"></a><p><dt><strong><strong><code>SOCKET-RECV:&lt;domain&gt;:&lt;type&gt;:&lt;protocol&gt;:&lt;local-address&gt;</code></strong></strong><dd>
  785. Creates a socket using the three given socket parameters (see man socket(2))
  786. and binds it to &lt;local-address&gt;. Receives arriving data. The three
  787. parameters have to be specified by <a href="socat.html#TYPE_INT">int</a> numbers. Consult your
  788. OS documentation and include files to find the appropriate values. The
  789. local-address must be the <a href="socat.html#TYPE_DATA">data</a> representation of a sockaddr
  790. structure without sa_family and (BSD) sa_len components.<br>
  791. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_RANGE">RANGE</a><br>
  792. Useful options:
  793. <a href="socat.html#OPTION_RANGE">range</a>,
  794. <a href="socat.html#OPTION_SETSOCKOPT_INT">setsockopt-int</a>,
  795. <a href="socat.html#OPTION_SETSOCKOPT_BIN">setsockopt-bin</a>,
  796. <a href="socat.html#OPTION_SETSOCKOPT_STRING">setsockopt-string</a>
  797. <br>
  798. See also:
  799. <a href="socat.html#ADDRESS_UDP_RECV">UDP-RECV</a>,
  800. <a href="socat.html#ADDRESS_IP_RECV">IP-RECV</a>,
  801. <a href="socat.html#ADDRESS_UNIX_RECV">UNIX-RECV</a>,
  802. <a href="socat.html#ADDRESS_SOCKET_DATAGRAM">SOCKET-DATAGRAM</a>,
  803. <a href="socat.html#ADDRESS_SOCKET_SENDTO">SOCKET-SENDTO</a>,
  804. <a href="socat.html#ADDRESS_SOCKET_RECVFROM">SOCKET-RECVFROM</a>
  805. <a name="ADDRESS_SOCKET_RECVFROM"></a><p><dt><strong><strong><code>SOCKET-RECVFROM:&lt;domain&gt;:&lt;type&gt;:&lt;protocol&gt;:&lt;local-address&gt;</code></strong></strong><dd>
  806. Creates a socket using the three given socket parameters (see man socket(2))
  807. and binds it to &lt;local-address&gt;. Receives arriving data and sends replies
  808. back to the sender. The first three parameters have to be specified as
  809. <a href="socat.html#TYPE_INT">int</a> numbers. Consult your OS documentation and include files
  810. to find the appropriate values. The local-address must be the
  811. <a href="socat.html#TYPE_DATA">data</a> representation of a sockaddr structure without
  812. sa_family and (BSD) sa_len components.<br>
  813. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a><br>
  814. Useful options:
  815. <a href="socat.html#OPTION_FORK">fork</a>,
  816. <a href="socat.html#OPTION_RANGE">range</a>,
  817. <a href="socat.html#OPTION_SETSOCKOPT_INT">setsockopt-int</a>,
  818. <a href="socat.html#OPTION_SETSOCKOPT_BIN">setsockopt-bin</a>,
  819. <a href="socat.html#OPTION_SETSOCKOPT_STRING">setsockopt-string</a>
  820. <br>
  821. See also:
  822. <a href="socat.html#ADDRESS_UDP_RECVFROM">UDP-RECVFROM</a>,
  823. <a href="socat.html#ADDRESS_IP_RECVFROM">IP-RECVFROM</a>,
  824. <a href="socat.html#ADDRESS_UNIX_RECVFROM">UNIX-RECVFROM</a>,
  825. <a href="socat.html#ADDRESS_SOCKET_DATAGRAM">SOCKET-DATAGRAM</a>,
  826. <a href="socat.html#ADDRESS_SOCKET_SENDTO">SOCKET-SENDTO</a>,
  827. <a href="socat.html#ADDRESS_SOCKET_RECV">SOCKET-RECV</a>
  828. <a name="ADDRESS_SOCKET_SENDTO"></a><p><dt><strong><strong><code>SOCKET-SENDTO:&lt;domain&gt;:&lt;type&gt;:&lt;protocol&gt;:&lt;remote-address&gt;</code></strong></strong><dd>
  829. Creates a socket using the three given socket parameters (see man
  830. socket(2)). Sends outgoing data to the given address and receives replies.
  831. The three parameters have to be specified as <a href="socat.html#TYPE_INT">int</a>
  832. numbers. Consult your OS documentation and include files to find the
  833. appropriate values. The remote-address must be the <a href="socat.html#TYPE_DATA">data</a>
  834. representation of a sockaddr structure without sa_family and (BSD) sa_len
  835. components.<br>
  836. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a><br>
  837. Useful options:
  838. <a href="socat.html#OPTION_BIND">bind</a>,
  839. <a href="socat.html#OPTION_SETSOCKOPT_INT">setsockopt-int</a>,
  840. <a href="socat.html#OPTION_SETSOCKOPT_BIN">setsockopt-bin</a>,
  841. <a href="socat.html#OPTION_SETSOCKOPT_STRING">setsockopt-string</a>
  842. <br>
  843. See also:
  844. <a href="socat.html#ADDRESS_UDP_SENDTO">UDP-SENDTO</a>,
  845. <a href="socat.html#ADDRESS_IP_SENDTO">IP-SENDTO</a>,
  846. <a href="socat.html#ADDRESS_UNIX_SENDTO">UNIX-SENDTO</a>,
  847. <a href="socat.html#ADDRESS_SOCKET_DATAGRAM">SOCKET-DATAGRAM</a>,
  848. <a href="socat.html#ADDRESS_SOCKET_RECV">SOCKET-RECV</a>
  849. <a href="socat.html#ADDRESS_SOCKET_RECVFROM">SOCKET-RECVFROM</a>
  850. <a name="ADDRESS_SOCKS4"></a><p><dt><strong><strong><code>SOCKS4:&lt;socks-server&gt;:&lt;host&gt;:&lt;port&gt;</code></strong></strong><dd>
  851. Connects via &lt;socks-server&gt; [<a href="socat.html#TYPE_IP_ADDRESS">IP address</a>]
  852. to &lt;host&gt; [<a href="socat.html#TYPE_IPV4_ADDRESS">IPv4 address</a>]
  853. on &lt;port&gt; [<a href="socat.html#TYPE_TCP_SERVICE">TCP service</a>],
  854. using socks version 4 protocol over IP version 4 or 6 depending on address specification, name resolution, or option
  855. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a> (<a href="socat.html#EXAMPLE_ADDRESS_SOCKS4">example</a>).<br>
  856. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_TCP">TCP</a>,<a href="socat.html#GROUP_SOCKS">SOCKS4</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  857. Useful options:
  858. <a href="socat.html#OPTION_SOCKSUSER">socksuser</a>,
  859. <a href="socat.html#OPTION_SOCKSPORT">socksport</a>,
  860. <a href="socat.html#OPTION_SOURCEPORT">sourceport</a>,
  861. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>,
  862. <a href="socat.html#OPTION_RETRY">retry</a><br>
  863. See also:
  864. <a href="socat.html#ADDRESS_SOCKS4A">SOCKS4A</a>,
  865. <a href="socat.html#ADDRESS_PROXY_CONNECT">PROXY</a>,
  866. <a href="socat.html#ADDRESS_TCP_CONNECT">TCP</a>
  867. <a name="ADDRESS_SOCKS4A"></a><p><dt><strong><strong><code>SOCKS4A:&lt;socks-server&gt;:&lt;host&gt;:&lt;port&gt;</code></strong></strong><dd>
  868. like <a href="socat.html#ADDRESS_SOCKS4">SOCKS4</a>, but uses socks protocol version 4a, thus
  869. leaving host name resolution to the socks server.<br>
  870. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_TCP">TCP</a>,<a href="socat.html#GROUP_SOCKS">SOCKS4</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  871. <a name="ADDRESS_STDERR"></a><p><dt><strong><strong><code>STDERR</code></strong></strong><dd>
  872. Uses file descriptor 2.<br>
  873. Option groups: <a href="socat.html#GROUP_FD">FD</a> (<a href="socat.html#GROUP_TERMIOS">TERMIOS</a>,<a href="socat.html#GROUP_REG">REG</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>) <br>
  874. See also: <a href="socat.html#ADDRESS_FD">FD</a>
  875. <a name="ADDRESS_STDIN"></a><p><dt><strong><strong><code>STDIN</code></strong></strong><dd>
  876. Uses file descriptor 0.<br>
  877. Option groups: <a href="socat.html#GROUP_FD">FD</a> (<a href="socat.html#GROUP_TERMIOS">TERMIOS</a>,<a href="socat.html#GROUP_REG">REG</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>) <br>
  878. Useful options:
  879. <a href="socat.html#OPTION_READBYTES">readbytes</a><br>
  880. See also: <a href="socat.html#ADDRESS_FD">FD</a>
  881. <a name="ADDRESS_STDIO"></a><p><dt><strong><strong><code>STDIO</code></strong></strong><dd>
  882. Uses file descriptor 0 for reading, and 1 for writing.<br>
  883. Option groups: <a href="socat.html#GROUP_FD">FD</a> (<a href="socat.html#GROUP_TERMIOS">TERMIOS</a>,<a href="socat.html#GROUP_REG">REG</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>) <br>
  884. Useful options:
  885. <a href="socat.html#OPTION_READBYTES">readbytes</a><br>
  886. See also: <a href="socat.html#ADDRESS_FD">FD</a>
  887. <a name="ADDRESS_STDOUT"></a><p><dt><strong><strong><code>STDOUT</code></strong></strong><dd>
  888. Uses file descriptor 1.<br>
  889. Option groups: <a href="socat.html#GROUP_FD">FD</a> (<a href="socat.html#GROUP_TERMIOS">TERMIOS</a>,<a href="socat.html#GROUP_REG">REG</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>) <br>
  890. See also: <a href="socat.html#ADDRESS_FD">FD</a>
  891. <a name="ADDRESS_SYSTEM"></a><p><dt><strong><strong><code>SYSTEM:&lt;shell-command&gt;</code></strong></strong><dd>
  892. Forks a sub process that establishes communication with its parent process
  893. and invokes the specified program with
  894. <code>system()</code>
  895. . Please note that
  896. &lt;shell-command&gt; [<a href="socat.html#TYPE_STRING">string</a>] must
  897. not contain ',' or "!!", and that shell meta characters may have to be
  898. protected.
  899. After successful program start, <strong>socat</strong> writes data to stdin of the
  900. process and reads from its stdout.<br>
  901. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_EXEC">EXEC</a>,<a href="socat.html#GROUP_FORK">FORK</a>,<a href="socat.html#GROUP_TERMIOS">TERMIOS</a> <br>
  902. Useful options:
  903. <a href="socat.html#OPTION_PATH">path</a>,
  904. <a href="socat.html#OPTION_FDIN">fdin</a>,
  905. <a href="socat.html#OPTION_FDOUT">fdout</a>,
  906. <a href="socat.html#OPTION_CHROOT">chroot</a>,
  907. <a href="socat.html#OPTION_SUBSTUSER">su</a>,
  908. <a href="socat.html#OPTION_SUBSTUSER_DELAYED">su-d</a>,
  909. <a href="socat.html#OPTION_NOFORK">nofork</a>,
  910. <a href="socat.html#OPTION_PTY">pty</a>,
  911. <a href="socat.html#OPTION_STDERR">stderr</a>,
  912. <a href="socat.html#OPTION_CTTY">ctty</a>,
  913. <a href="socat.html#OPTION_SETSID">setsid</a>,
  914. <a href="socat.html#OPTION_PIPES">pipes</a>,
  915. <a href="socat.html#OPTION_SIGINT">sigint</a>,
  916. <a href="socat.html#OPTION_SIGQUIT">sigquit</a><br>
  917. See also: <a href="socat.html#ADDRESS_EXEC">EXEC</a>
  918. <a name="ADDRESS_TCP_CONNECT"></a><p><dt><strong><strong><code>TCP:&lt;host&gt;:&lt;port&gt;</code></strong></strong><dd>
  919. Connects to &lt;port&gt; [<a href="socat.html#TYPE_TCP_SERVICE">TCP service</a>] on
  920. &lt;host&gt; [<a href="socat.html#TYPE_IP_ADDRESS">IP address</a>] using TCP/IP version 4 or 6
  921. depending on address specification, name resolution, or option
  922. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>.<br>
  923. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_TCP">TCP</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  924. Useful options:
  925. <a href="socat.html#OPTION_CRNL">crnl</a>,
  926. <a href="socat.html#OPTION_BIND">bind</a>,
  927. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>,
  928. <a href="socat.html#OPTION_CONNECT_TIMEOUT">connect-timeout</a>,
  929. <a href="socat.html#OPTION_TOS">tos</a>,
  930. <a href="socat.html#OPTION_MTUDISCOVER">mtudiscover</a>,
  931. <a href="socat.html#OPTION_MSS">mss</a>,
  932. <a href="socat.html#OPTION_NODELAY">nodelay</a>,
  933. <a href="socat.html#OPTION_NONBLOCK">nonblock</a>,
  934. <a href="socat.html#OPTION_SOURCEPORT">sourceport</a>,
  935. <a href="socat.html#OPTION_RETRY">retry</a>,
  936. <a href="socat.html#OPTION_READBYTES">readbytes</a><br>
  937. See also:
  938. <a href="socat.html#ADDRESS_TCP4_CONNECT">TCP4</a>,
  939. <a href="socat.html#ADDRESS_TCP6_CONNECT">TCP6</a>,
  940. <a href="socat.html#ADDRESS_TCP_LISTEN">TCP-LISTEN</a>,
  941. <a href="socat.html#ADDRESS_UDP_CONNECT">UDP</a>,
  942. <a href="socat.html#ADDRESS_SCTP_CONNECT">SCTP-CONNECT</a>,
  943. <a href="socat.html#ADDRESS_UNIX_CONNECT">UNIX-CONNECT</a>
  944. <a name="ADDRESS_TCP4_CONNECT"></a><p><dt><strong><strong><code>TCP4:&lt;host&gt;:&lt;port&gt;</code></strong></strong><dd>
  945. Like <a href="socat.html#ADDRESS_TCP_CONNECT">TCP</a>, but only supports IPv4 protocol (<a href="socat.html#EXAMPLE_ADDRESS_TCP4_CONNECT">example</a>).<br>
  946. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_TCP">TCP</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  947. <a name="ADDRESS_TCP6_CONNECT"></a><p><dt><strong><strong><code>TCP6:&lt;host&gt;:&lt;port&gt;</code></strong></strong><dd>
  948. Like <a href="socat.html#ADDRESS_TCP_CONNECT">TCP</a>, but only supports IPv6 protocol.<br>
  949. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_TCP">TCP</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  950. <a name="ADDRESS_TCP_LISTEN"></a><p><dt><strong><strong><code>TCP-LISTEN:&lt;port&gt;</code></strong></strong><dd>
  951. Listens on &lt;port&gt; [<a href="socat.html#TYPE_TCP_SERVICE">TCP service</a>] and accepts a
  952. TCP/IP connection. The IP version is 4 or the one specified with
  953. address option <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>, socat option
  954. (<a href="socat.html#option_4">-4</a>, <a href="socat.html#option_6">-6</a>), or environment variable <a href="socat.html#ENV_SOCAT_DEFAULT_LISTEN_IP">SOCAT_DEFAULT_LISTEN_IP</a>.
  955. Note that opening
  956. this address usually blocks until a client connects.<br>
  957. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_LISTEN">LISTEN</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_TCP">TCP</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  958. Useful options:
  959. <a href="socat.html#OPTION_CRNL">crnl</a>,
  960. <a href="socat.html#OPTION_FORK">fork</a>,
  961. <a href="socat.html#OPTION_BIND">bind</a>,
  962. <a href="socat.html#OPTION_RANGE">range</a>,
  963. <a href="socat.html#OPTION_TCPWRAPPERS">tcpwrap</a>,
  964. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>,
  965. <a href="socat.html#OPTION_MAX_CHILDREN">max-children</a>,
  966. <a href="socat.html#OPTION_BACKLOG">backlog</a>,
  967. <a href="socat.html#OPTION_MSS">mss</a>,
  968. <a href="socat.html#OPTION_SUBSTUSER">su</a>,
  969. <a href="socat.html#OPTION_REUSEADDR">reuseaddr</a>,
  970. <a href="socat.html#OPTION_RETRY">retry</a>,
  971. <a href="socat.html#OPTION_COOL_WRITE">cool-write</a><br>
  972. See also:
  973. <a href="socat.html#ADDRESS_TCP4_LISTEN">TCP4-LISTEN</a>,
  974. <a href="socat.html#ADDRESS_TCP6_LISTEN">TCP6-LISTEN</a>,
  975. <a href="socat.html#ADDRESS_UDP_LISTEN">UDP-LISTEN</a>,
  976. <a href="socat.html#ADDRESS_SCTP_LISTEN">SCTP-LISTEN</a>,
  977. <a href="socat.html#ADDRESS_UNIX_LISTEN">UNIX-LISTEN</a>,
  978. <a href="socat.html#ADDRESS_OPENSSL_LISTEN">OPENSSL-LISTEN</a>,
  979. <a href="socat.html#ADDRESS_TCP_CONNECT">TCP-CONNECT</a>
  980. <a name="ADDRESS_TCP4_LISTEN"></a><p><dt><strong><strong><code>TCP4-LISTEN:&lt;port&gt;</code></strong></strong><dd>
  981. Like <a href="socat.html#ADDRESS_TCP_LISTEN">TCP-LISTEN</a>, but only supports IPv4
  982. protocol (<a href="socat.html#EXAMPLE_ADDRESS_TCP4_LISTEN">example</a>).<br>
  983. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_LISTEN">LISTEN</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_TCP">TCP</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  984. <a name="ADDRESS_TCP6_LISTEN"></a><p><dt><strong><strong><code>TCP6-LISTEN:&lt;port&gt;</code></strong></strong><dd>
  985. Like <a href="socat.html#ADDRESS_TCP_LISTEN">TCP-LISTEN</a>, but only supports IPv6
  986. protocol.<br>
  987. Additional useful option:
  988. <a href="socat.html#OPTION_IPV6_V6ONLY">ipv6only</a><br>
  989. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_LISTEN">LISTEN</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_TCP">TCP</a>,<a href="socat.html#GROUP_RETRY">RETRY</a> <br>
  990. <a name="ADDRESS_TUN"></a><p><dt><strong><strong><code>TUN[:&lt;if-addr&gt;/&lt;bits&gt;]</code></strong></strong><dd>
  991. Creates a Linux TUN/TAP device and optionally assignes it the address and
  992. netmask given by the parameters. The resulting network interface is almost
  993. ready for use by other processes; socat serves its "wire side". This address
  994. requires read and write access to the tunnel cloning device, usually
  995. <code>/dev/net/tun</code>
  996. , as well as permission to set some <code>ioctl()s</code>.
  997. <strong>Option iff-up is required to immediately activate the interface!</strong><br>
  998. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_NAMED">NAMED</a>,<a href="socat.html#GROUP_OPEN">OPEN</a>,<a href="socat.html#GROUP_TUN">TUN</a> <br>
  999. Useful options:
  1000. <a href="socat.html#OPTION_IFF_UP">iff-up</a>,
  1001. <a href="socat.html#OPTION_TUN_DEVICE">tun-device</a>,
  1002. <a href="socat.html#OPTION_TUN_NAME">tun-name</a>,
  1003. <a href="socat.html#OPTION_TUN_TYPE">tun-type</a>,
  1004. <a href="socat.html#OPTION_IFF_NO_PI">iff-no-pi</a> <br>
  1005. See also:
  1006. <a href="socat.html#ADDRESS_IP_RECV">ip-recv</a>
  1007. <a name="ADDRESS_UDP_CONNECT"></a><p><dt><strong><strong><code>UDP:&lt;host&gt;:&lt;port&gt;</code></strong></strong><dd>
  1008. Connects to &lt;port&gt; [<a href="socat.html#TYPE_UDP_SERVICE">UDP service</a>] on
  1009. &lt;host&gt; [<a href="socat.html#TYPE_IP_ADDRESS">IP address</a>] using UDP/IP version 4 or 6
  1010. depending on address specification, name resolution, or option
  1011. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>.<br>
  1012. Please note that,
  1013. due to UDP protocol properties, no real connection is established; data has
  1014. to be sent for `connecting' to the server, and no end-of-file condition can
  1015. be transported.<br>
  1016. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a> <br>
  1017. Useful options:
  1018. <a href="socat.html#OPTION_TTL">ttl</a>,
  1019. <a href="socat.html#OPTION_TOS">tos</a>,
  1020. <a href="socat.html#OPTION_BIND">bind</a>,
  1021. <a href="socat.html#OPTION_SOURCEPORT">sourceport</a>,
  1022. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a><br>
  1023. See also:
  1024. <a href="socat.html#ADDRESS_UDP4_CONNECT">UDP4</a>,
  1025. <a href="socat.html#ADDRESS_UDP6_CONNECT">UDP6</a>,
  1026. <a href="socat.html#ADDRESS_UDP_LISTEN">UDP-LISTEN</a>,
  1027. <a href="socat.html#ADDRESS_TCP_CONNECT">TCP</a>,
  1028. <a href="socat.html#ADDRESS_IP_SENDTO">IP</a>
  1029. <a name="ADDRESS_UDP4_CONNECT"></a><p><dt><strong><strong><code>UDP4:&lt;host&gt;:&lt;port&gt;</code></strong></strong><dd>
  1030. Like <a href="socat.html#ADDRESS_UDP_CONNECT">UDP</a>, but only supports IPv4 protocol.<br>
  1031. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a> <br>
  1032. <a name="ADDRESS_UDP6_CONNECT"></a><p><dt><strong><strong><code>UDP6:&lt;host&gt;:&lt;port&gt;</code></strong></strong><dd>
  1033. Like <a href="socat.html#ADDRESS_UDP_CONNECT">UDP</a>, but only supports IPv6 protocol.<br>
  1034. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP6">IP6</a> <br>
  1035. <a name="ADDRESS_UDP_DATAGRAM"></a><p><dt><strong><strong><code>UDP-DATAGRAM:&lt;address&gt;:&lt;port&gt;</code></strong></strong><dd>
  1036. Sends outgoing data to the specified address which may in particular be a
  1037. broadcast or multicast address. Packets arriving on the local socket are
  1038. checked for the correct remote port and if their source addresses match
  1039. <a href="socat.html#OPTION_RANGE">RANGE</a> or <a href="socat.html#OPTION_TCPWRAPPERS">TCPWRAP</a>
  1040. options. This address type can for example be used for implementing
  1041. symmetric or asymmetric broadcast or multicast communications.<br>
  1042. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_RANGE">RANGE</a> <br>
  1043. Useful options:
  1044. <a href="socat.html#OPTION_BIND">bind</a>,
  1045. <a href="socat.html#OPTION_RANGE">range</a>,
  1046. <a href="socat.html#OPTION_TCPWRAPPERS">tcpwrap</a>,
  1047. <a href="socat.html#OPTION_SO_BROADCAST">broadcast</a>,
  1048. <a href="socat.html#OPTION_IP_MULTICAST_LOOP">ip-multicast-loop</a>,
  1049. <a href="socat.html#OPTION_IP_MULTICAST_TTL">ip-multicast-ttl</a>,
  1050. <a href="socat.html#OPTION_IP_MULTICAST_IF">ip-multicast-if</a>,
  1051. <a href="socat.html#OPTION_IP_ADD_MEMBERSHIP">ip-add-membership</a>,
  1052. <a href="socat.html#OPTION_TTL">ttl</a>,
  1053. <a href="socat.html#OPTION_TOS">tos</a>,
  1054. <a href="socat.html#OPTION_SOURCEPORT">sourceport</a>,
  1055. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a><br>
  1056. See also:
  1057. <a href="socat.html#ADDRESS_UDP4_DATAGRAM">UDP4-DATAGRAM</a>,
  1058. <a href="socat.html#ADDRESS_UDP6_DATAGRAM">UDP6-DATAGRAM</a>,
  1059. <a href="socat.html#ADDRESS_UDP_SENDTO">UDP-SENDTO</a>,
  1060. <a href="socat.html#ADDRESS_UDP_RECVFROM">UDP-RECVFROM</a>,
  1061. <a href="socat.html#ADDRESS_UDP_RECV">UDP-RECV</a>,
  1062. <a href="socat.html#ADDRESS_UDP_CONNECT">UDP-CONNECT</a>,
  1063. <a href="socat.html#ADDRESS_UDP_LISTEN">UDP-LISTEN</a>,
  1064. <a href="socat.html#ADDRESS_IP_DATAGRAM">IP-DATAGRAM</a>
  1065. <a name="ADDRESS_UDP4_DATAGRAM"></a><p><dt><strong><strong><code>UDP4-DATAGRAM:&lt;address&gt;:&lt;port&gt;</code></strong></strong><dd>
  1066. Like <a href="socat.html#ADDRESS_UDP_DATAGRAM">UDP-DATAGRAM</a>, but only supports IPv4
  1067. protocol (<a href="socat.html#EXAMPLE_ADDRESS_UDP4_BROADCAST_CLIENT">example1</a>,
  1068. <a href="socat.html#EXAMPLE_ADDRESS_UDP4_MULTICAST">example2</a>).<br>
  1069. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>, <a href="socat.html#GROUP_RANGE">RANGE</a>
  1070. <a name="ADDRESS_UDP6_DATAGRAM"></a><p><dt><strong><strong><code>UDP6-DATAGRAM:&lt;address&gt;:&lt;port&gt;</code></strong></strong><dd>
  1071. Like <a href="socat.html#ADDRESS_UDP_DATAGRAM">UDP-DATAGRAM</a>, but only supports IPv6
  1072. protocol.<br>
  1073. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>
  1074. <a name="ADDRESS_UDP_LISTEN"></a><p><dt><strong><strong><code>UDP-LISTEN:&lt;port&gt;</code></strong></strong><dd>
  1075. Waits for a UDP/IP packet arriving on &lt;port&gt;
  1076. [<a href="socat.html#TYPE_UDP_SERVICE">UDP service</a>] and `connects' back to sender.
  1077. The accepted IP version is 4 or the one specified with option
  1078. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>.
  1079. Please note that,
  1080. due to UDP protocol properties, no real connection is established; data has
  1081. to arrive from the peer first, and no end-of-file condition can be
  1082. transported. Note that opening
  1083. this address usually blocks until a client connects.<br>
  1084. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_LISTEN">LISTEN</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a> <br>
  1085. Useful options:
  1086. <a href="socat.html#OPTION_FORK">fork</a>,
  1087. <a href="socat.html#OPTION_BIND">bind</a>,
  1088. <a href="socat.html#OPTION_RANGE">range</a>,
  1089. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a> <br>
  1090. See also:
  1091. <a href="socat.html#ADDRESS_UDP_CONNECT">UDP</a>,
  1092. <a href="socat.html#ADDRESS_UDP4_LISTEN">UDP4-LISTEN</a>,
  1093. <a href="socat.html#ADDRESS_UDP6_LISTEN">UDP6-LISTEN</a>,
  1094. <a href="socat.html#ADDRESS_TCP_LISTEN">TCP-LISTEN</a>
  1095. <a name="ADDRESS_UDP4_LISTEN"></a><p><dt><strong><strong><code>UDP4-LISTEN:&lt;port&gt;</code></strong></strong><dd>
  1096. Like <a href="socat.html#ADDRESS_UDP_LISTEN">UDP-LISTEN</a>, but only support IPv4
  1097. protocol.<br>
  1098. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_LISTEN">LISTEN</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>,<a href="socat.html#GROUP_IP4">IP4</a> <br>
  1099. <a name="ADDRESS_UDP6_LISTEN"></a><p><dt><strong><strong><code>UDP6-LISTEN:&lt;port&gt;</code></strong></strong><dd>
  1100. Like <a href="socat.html#ADDRESS_UDP_LISTEN">UDP-LISTEN</a>, but only support IPv6
  1101. protocol.<br>
  1102. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_LISTEN">LISTEN</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>,<a href="socat.html#GROUP_IP6">IP6</a> <br>
  1103. <a name="ADDRESS_UDP_SENDTO"></a><p><dt><strong><strong><code>UDP-SENDTO:&lt;host&gt;:&lt;port&gt;</code></strong></strong><dd>
  1104. Communicates with the specified peer socket, defined by &lt;port&gt; [<a href="socat.html#TYPE_UDP_SERVICE">UDP
  1105. service</a>] on
  1106. &lt;host&gt; [<a href="socat.html#TYPE_IP_ADDRESS">IP address</a>], using UDP/IP version 4 or 6
  1107. depending on address specification, name resolution, or option
  1108. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>. It sends packets to and receives packets
  1109. from that peer socket only.
  1110. This address effectively implements a datagram client.
  1111. It works well with socat UDP-RECVFROM and UDP-RECV address peers.<br>
  1112. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a> <br>
  1113. Useful options:
  1114. <a href="socat.html#OPTION_TTL">ttl</a>,
  1115. <a href="socat.html#OPTION_TOS">tos</a>,
  1116. <a href="socat.html#OPTION_BIND">bind</a>,
  1117. <a href="socat.html#OPTION_SOURCEPORT">sourceport</a>,
  1118. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a><br>
  1119. See also:
  1120. <a href="socat.html#ADDRESS_UDP4_SENDTO">UDP4-SENDTO</a>,
  1121. <a href="socat.html#ADDRESS_UDP6_SENDTO">UDP6-SENDTO</a>,
  1122. <a href="socat.html#ADDRESS_UDP_RECVFROM">UDP-RECVFROM</a>,
  1123. <a href="socat.html#ADDRESS_UDP_RECV">UDP-RECV</a>,
  1124. <a href="socat.html#ADDRESS_UDP_CONNECT">UDP-CONNECT</a>,
  1125. <a href="socat.html#ADDRESS_UDP_LISTEN">UDP-LISTEN</a>,
  1126. <a href="socat.html#ADDRESS_IP_SENDTO">IP-SENDTO</a>
  1127. <a name="ADDRESS_UDP4_SENDTO"></a><p><dt><strong><strong><code>UDP4-SENDTO:&lt;host&gt;:&lt;port&gt;</code></strong></strong><dd>
  1128. Like <a href="socat.html#ADDRESS_UDP_SENDTO">UDP-SENDTO</a>, but only supports IPv4
  1129. protocol.<br>
  1130. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>
  1131. <a name="ADDRESS_UDP6_SENDTO"></a><p><dt><strong><strong><code>UDP6-SENDTO:&lt;host&gt;:&lt;port&gt;</code></strong></strong><dd>
  1132. Like <a href="socat.html#ADDRESS_UDP_SENDTO">UDP-SENDTO</a>, but only supports IPv6
  1133. protocol.<br>
  1134. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP6">IP6</a>
  1135. <p>
  1136. <a name="ADDRESS_UDP_RECVFROM"></a><p><dt><strong><strong><code>UDP-RECVFROM:&lt;port&gt;</code></strong></strong><dd>
  1137. Creates a UDP socket on &lt;port&gt; [<a href="socat.html#TYPE_UDP_SERVICE">UDP service</a>] using
  1138. UDP/IP version 4 or 6
  1139. depending on option <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>.
  1140. It receives one packet from an unspecified peer and may send one or more
  1141. answer packets to that peer. This mode is particularly useful with fork
  1142. option
  1143. where each arriving packet - from arbitrary peers - is handled by its own sub
  1144. process. This allows a behaviour similar to typical UDP based servers like ntpd
  1145. or named. This address works well with socat UDP-SENDTO address peers.<br>
  1146. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a> <br>
  1147. Useful options:
  1148. <a href="socat.html#OPTION_FORK">fork</a>,
  1149. <a href="socat.html#OPTION_TTL">ttl</a>,
  1150. <a href="socat.html#OPTION_TOS">tos</a>,
  1151. <a href="socat.html#OPTION_BIND">bind</a>,
  1152. <a href="socat.html#OPTION_SOURCEPORT">sourceport</a>,
  1153. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a><br>
  1154. See also:
  1155. <a href="socat.html#ADDRESS_UDP4_RECVFROM">UDP4-RECVFROM</a>,
  1156. <a href="socat.html#ADDRESS_UDP6_RECVFROM">UDP6-RECVFROM</a>,
  1157. <a href="socat.html#ADDRESS_UDP_SENDTO">UDP-SENDTO</a>,
  1158. <a href="socat.html#ADDRESS_UDP_RECV">UDP-RECV</a>,
  1159. <a href="socat.html#ADDRESS_UDP_CONNECT">UDP-CONNECT</a>,
  1160. <a href="socat.html#ADDRESS_UDP_LISTEN">UDP-LISTEN</a>,
  1161. <a href="socat.html#ADDRESS_IP_RECVFROM">IP-RECVFROM</a>,
  1162. <a href="socat.html#ADDRESS_UNIX_RECVFROM">UNIX-RECVFROM</a>
  1163. <a name="ADDRESS_UDP4_RECVFROM"></a><p><dt><strong><strong><code>UDP4-RECVFROM:&lt;port&gt;</code></strong></strong><dd>
  1164. Like <a href="socat.html#ADDRESS_UDP_RECVFROM">UDP-RECVFROM</a>, but only supports IPv4 protocol.<br>
  1165. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>
  1166. <a name="ADDRESS_UDP6_RECVFROM"></a><p><dt><strong><strong><code>UDP6-RECVFROM:&lt;port&gt;</code></strong></strong><dd>
  1167. Like <a href="socat.html#ADDRESS_UDP_RECVFROM">UDP-RECVFROM</a>, but only supports IPv6 protocol.<br>
  1168. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>
  1169. <p>
  1170. <a name="ADDRESS_UDP_RECV"></a><p><dt><strong><strong><code>UDP-RECV:&lt;port&gt;</code></strong></strong><dd>
  1171. Creates a UDP socket on &lt;port&gt; [<a href="socat.html#TYPE_UDP_SERVICE">UDP service</a>] using UDP/IP version 4 or 6
  1172. depending on option <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>.
  1173. It receives packets from multiple unspecified peers and merges the data.
  1174. No replies are possible. It works well with, e.g., socat UDP-SENDTO address peers; it behaves similar to a syslog server.<br>
  1175. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_RANGE">RANGE</a> <br>
  1176. Useful options:
  1177. <a href="socat.html#OPTION_FORK">fork</a>,
  1178. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a>,
  1179. <a href="socat.html#OPTION_BIND">bind</a>,
  1180. <a href="socat.html#OPTION_SOURCEPORT">sourceport</a>,
  1181. <a href="socat.html#OPTION_TTL">ttl</a>,
  1182. <a href="socat.html#OPTION_TOS">tos</a><br>
  1183. See also:
  1184. <a href="socat.html#ADDRESS_UDP4_RECV">UDP4-RECV</a>,
  1185. <a href="socat.html#ADDRESS_UDP6_RECV">UDP6-RECV</a>,
  1186. <a href="socat.html#ADDRESS_UDP_SENDTO">UDP-SENDTO</a>,
  1187. <a href="socat.html#ADDRESS_UDP_RECVFROM">UDP-RECVFROM</a>,
  1188. <a href="socat.html#ADDRESS_UDP_CONNECT">UDP-CONNECT</a>,
  1189. <a href="socat.html#ADDRESS_UDP_LISTEN">UDP-LISTEN</a>,
  1190. <a href="socat.html#ADDRESS_IP_RECV">IP-RECV</a>,
  1191. <a href="socat.html#ADDRESS_UNIX_RECV">UNIX-RECV</a>
  1192. <a name="ADDRESS_UDP4_RECV"></a><p><dt><strong><strong><code>UDP4-RECV:&lt;port&gt;</code></strong></strong><dd>
  1193. Like <a href="socat.html#ADDRESS_UDP_RECV">UDP-RECV</a>, but only supports IPv4 protocol.<br>
  1194. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP4">IP4</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>
  1195. <a name="ADDRESS_UDP6_RECV"></a><p><dt><strong><strong><code>UDP6-RECV:&lt;port&gt;</code></strong></strong><dd>
  1196. Like <a href="socat.html#ADDRESS_UDP_RECV">UDP-RECV</a>, but only supports IPv6 protocol.<br>
  1197. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_IP6">IP6</a>,<a href="socat.html#GROUP_RANGE">RANGE</a>
  1198. <p>
  1199. <a name="ADDRESS_UNIX_CONNECT"></a><p><dt><strong><strong><code>UNIX-CONNECT:&lt;filename&gt;</code></strong></strong><dd>
  1200. Connects to <a href="socat.html#TYPE_FILENAME">&lt;filename&gt;</a> assuming it is a UNIX domain
  1201. socket.
  1202. If &lt;filename&gt; does not exist, this is an error;
  1203. if &lt;filename&gt; is not a UNIX domain socket, this is an error;
  1204. if &lt;filename&gt; is a UNIX domain socket, but no process is listening, this is
  1205. an error.<br>
  1206. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_NAMED">NAMED</a>,<a href="socat.html#GROUP_RETRY">RETRY</a>,<a href="socat.html#GROUP_SOCK_UNIX">UNIX</a> <br>)
  1207. Useful options:
  1208. <a href="socat.html#OPTION_BIND">bind</a><br>
  1209. See also:
  1210. <a href="socat.html#ADDRESS_UNIX_LISTEN">UNIX-LISTEN</a>,
  1211. <a href="socat.html#ADDRESS_UNIX_SENDTO">UNIX-SENDTO</a>,
  1212. <a href="socat.html#ADDRESS_TCP_CONNECT">TCP</a>
  1213. <p>
  1214. <a name="ADDRESS_UNIX_LISTEN"></a><p><dt><strong><strong><code>UNIX-LISTEN:&lt;filename&gt;</code></strong></strong><dd>
  1215. Listens on <a href="socat.html#TYPE_FILENAME">&lt;filename&gt;</a> using a UNIX domain stream
  1216. socket and accepts a connection.
  1217. If &lt;filename&gt; exists and is not a socket, this is an error.
  1218. If &lt;filename&gt; exists and is a UNIX domain socket, binding to the address
  1219. fails (use option <a href="socat.html#OPTION_UNLINK_EARLY">unlink-early</a>!).
  1220. Note that opening this address usually blocks until a client connects.
  1221. Beginning with socat version 1.4.3, the file system entry is removed when
  1222. this address is closed (but see option <a href="socat.html#OPTION_UNLINK_CLOSE">unlink-close</a>) (<a href="socat.html#EXAMPLE_ADDRESS_UNIX_LISTEN">example</a>).<br>
  1223. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_NAMED">NAMED</a>,<a href="socat.html#GROUP_LISTEN">LISTEN</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_RETRY">RETRY</a>,<a href="socat.html#GROUP_SOCK_UNIX">UNIX</a> <br>
  1224. Useful options:
  1225. <a href="socat.html#OPTION_FORK">fork</a>,
  1226. <a href="socat.html#OPTION_UMASK">umask</a>,
  1227. <a href="socat.html#OPTION_MODE">mode</a>,
  1228. <a href="socat.html#OPTION_USER">user</a>,
  1229. <a href="socat.html#OPTION_GROUP">group</a>,
  1230. <a href="socat.html#OPTION_UNLINK_EARLY">unlink-early</a><br>
  1231. See also:
  1232. <a href="socat.html#ADDRESS_UNIX_CONNECT">UNIX-CONNECT</a>,
  1233. <a href="socat.html#ADDRESS_UNIX_RECVFROM">UNIX-RECVFROM</a>,
  1234. <a href="socat.html#ADDRESS_UNIX_RECV">UNIX-RECV</a>,
  1235. <a href="socat.html#ADDRESS_TCP4_LISTEN">TCP-LISTEN</a>
  1236. <p>
  1237. <a name="ADDRESS_UNIX_SENDTO"></a><p><dt><strong><strong><code>UNIX-SENDTO:&lt;filename&gt;</code></strong></strong><dd>
  1238. Communicates with the specified peer socket, defined by [<a href="socat.html#TYPE_FILENAME">&lt;filename&gt;</a>] assuming it is a UNIX domain datagram socket.
  1239. It sends packets to and receives packets from that peer socket only.
  1240. Please note that it might be necessary to <a href="socat.html#OPTION_BIND">bind</a> the
  1241. local socket to an address (e.g. <code>/tmp/sock1</code>, which must not exist
  1242. before).
  1243. This address type works well with socat UNIX-RECVFROM and UNIX-RECV address
  1244. peers.<br>
  1245. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_NAMED">NAMED</a>,<a href="socat.html#GROUP_SOCK_UNIX">UNIX</a><br>
  1246. Useful options:
  1247. <a href="socat.html#OPTION_BIND">bind</a><br>
  1248. See also:
  1249. <a href="socat.html#ADDRESS_UNIX_RECVFROM">UNIX-RECVFROM</a>,
  1250. <a href="socat.html#ADDRESS_UNIX_RECV">UNIX-RECV</a>,
  1251. <a href="socat.html#ADDRESS_UNIX_CONNECT">UNIX-CONNECT</a>,
  1252. <a href="socat.html#ADDRESS_UDP_SENDTO">UDP-SENDTO</a>,
  1253. <a href="socat.html#ADDRESS_IP_SENDTO">IP-SENDTO</a>
  1254. <p>
  1255. <a name="ADDRESS_UNIX_RECVFROM"></a><p><dt><strong><strong><code>UNIX-RECVFROM:&lt;filename&gt;</code></strong></strong><dd>
  1256. Creates a UNIX domain datagram socket [<a href="socat.html#TYPE_FILENAME">&lt;filename&gt;</a>].
  1257. Receives one packet and may send one or more answer packets to that peer.
  1258. This mode is particularly useful with fork option where each arriving packet - from arbitrary peers - is handled by its own sub process.
  1259. This address works well with socat UNIX-SENDTO address peers.<br>
  1260. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_NAMED">NAMED</a>,<a href="socat.html#GROUP_CHILD">CHILD</a>,<a href="socat.html#GROUP_SOCK_UNIX">UNIX</a> <br>
  1261. Useful options:
  1262. <a href="socat.html#OPTION_FORK">fork</a><br>
  1263. See also:
  1264. <a href="socat.html#ADDRESS_UNIX_SENDTO">UNIX-SENDTO</a>,
  1265. <a href="socat.html#ADDRESS_UNIX_RECV">UNIX-RECV</a>,
  1266. <a href="socat.html#ADDRESS_UNIX_LISTEN">UNIX-LISTEN</a>,
  1267. <a href="socat.html#ADDRESS_UDP_RECVFROM">UDP-RECVFROM</a>,
  1268. <a href="socat.html#ADDRESS_IP_RECVFROM">IP-RECVFROM</a>
  1269. <p>
  1270. <a name="ADDRESS_UNIX_RECV"></a><p><dt><strong><strong><code>UNIX-RECV:&lt;filename&gt;</code></strong></strong><dd>
  1271. Creates a UNIX domain datagram socket [<a href="socat.html#TYPE_FILENAME">&lt;filename&gt;</a>].
  1272. Receives packets from multiple unspecified peers and merges the data.
  1273. No replies are possible. It can be, e.g., addressed by socat UNIX-SENDTO address peers.
  1274. It behaves similar to a syslog server.
  1275. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_NAMED">NAMED</a>,<a href="socat.html#GROUP_SOCK_UNIX">UNIX</a> <br>
  1276. See also:
  1277. <a href="socat.html#ADDRESS_UNIX_SENDTO">UNIX-SENDTO</a>,
  1278. <a href="socat.html#ADDRESS_UNIX_RECVFROM">UNIX-RECVFROM</a>,
  1279. <a href="socat.html#ADDRESS_UNIX_LISTEN">UNIX-LISTEN</a>,
  1280. <a href="socat.html#ADDRESS_UDP_RECV">UDP-RECV</a>,
  1281. <a href="socat.html#ADDRESS_IP_RECV">IP-RECV</a>
  1282. <p>
  1283. <a name="ADDRESS_UNIX_CLIENT"></a><p><dt><strong><strong><code>UNIX-CLIENT:&lt;filename&gt;</code></strong></strong><dd>
  1284. Communicates with the specified peer socket, defined by
  1285. [<a href="socat.html#TYPE_FILENAME">&lt;filename&gt;</a>] assuming it is a UNIX domain socket.
  1286. It first tries to connect and, if that fails, assumes it is a datagram
  1287. socket, thus supporting both types.<br>
  1288. Option groups: <a href="socat.html#GROUP_FD">FD</a>,<a href="socat.html#GROUP_SOCKET">SOCKET</a>,<a href="socat.html#GROUP_NAMED">NAMED</a>,<a href="socat.html#GROUP_SOCK_UNIX">UNIX</a> <br>
  1289. Useful options:
  1290. <a href="socat.html#OPTION_BIND">bind</a><br>
  1291. See also:
  1292. <a href="socat.html#ADDRESS_UNIX_CONNECT">UNIX-CONNECT</a>,
  1293. <a href="socat.html#ADDRESS_UNIX_SENDTO">UNIX-SENDTO</a>,
  1294. <a href="socat.html#ADDRESS_GOPEN">GOPEN</a>
  1295. <p>
  1296. <p><dt><strong><strong><code>ABSTRACT-CONNECT:&lt;string&gt;</code></strong></strong><dd>
  1297. <p><dt><strong><strong><code>ABSTRACT-LISTEN:&lt;string&gt;</code></strong></strong><dd>
  1298. <p><dt><strong><strong><code>ABSTRACT-SENDTO:&lt;string&gt;</code></strong></strong><dd>
  1299. <p><dt><strong><strong><code>ABSTRACT-RECVFROM:&lt;string&gt;</code></strong></strong><dd>
  1300. <p><dt><strong><strong><code>ABSTRACT-RECV:&lt;string&gt;</code></strong></strong><dd>
  1301. <p><dt><strong><strong><code>ABSTRACT-CLIENT:&lt;string&gt;</code></strong></strong><dd>
  1302. The ABSTRACT addresses are almost identical to the related UNIX addresses
  1303. except that they do not address file system based sockets but an alternate
  1304. UNIX domain address space. To achieve this the socket address strings are
  1305. prefixed with "\0" internally. This feature is available (only?) on Linux.
  1306. Option groups are the same as with the related UNIX addresses, except that
  1307. the ABSTRACT addresses are not member of the NAMED group.
  1308. </dl>
  1309. <p>
  1310. <a name="ADDRESS_OPTIONS"></a>
  1311. <h2>ADDRESS OPTIONS</h2>
  1312. <p>
  1313. Address options can be applied to address specifications to influence the
  1314. process of opening the addresses and the
  1315. properties of the resulting data channels.
  1316. <p>
  1317. For technical reasons not every option can be
  1318. applied to every address type; e.g., applying a socket option to a regular file
  1319. will fail. To catch most useless combinations as early as in the open phase,
  1320. the concept of <em>option groups</em> was introduced. Each option belongs to one
  1321. or more option groups. Options can be used only with address types that support
  1322. at least one of their option groups (but see <a href="socat.html#option_g">option -g</a>).
  1323. <p>
  1324. Address options have data types that their values must conform to.
  1325. Every address option consists of just a keyword or a keyword followed by
  1326. "=value", where value must conform to the options type.
  1327. Some address options manipulate parameters of system calls;
  1328. e.g., option sync sets the
  1329. <code>O_SYNC</code>
  1330. flag with the
  1331. <code>open()</code>
  1332. call.
  1333. Other options cause a system or library call; e.g., with option `ttl=value'
  1334. the
  1335. <code>setsockopt(fd, SOL_IP, IP_TTL, value, sizeof(int))</code>
  1336. call is applied.
  1337. Other
  1338. options set internal <strong>socat</strong> variables that are used during data transfer;
  1339. e.g., `crnl' causes explicit character conversions.
  1340. A few options have more complex implementations; e.g., su-d
  1341. (substuser-delayed) inquires some user and group infos, stores them, and
  1342. applies them later after a possible
  1343. <code>chroot()</code>
  1344. call.
  1345. <p>
  1346. If multiple options are given to an address, their sequence in the address specification has (almost) no
  1347. effect on the sequence of their execution/application. Instead, <strong>socat</strong> has
  1348. built in an <em>option phase</em> model that tries to bring the options in a useful
  1349. order. Some options exist in different forms (e.g.,
  1350. unlink, unlink-early, unlink-late) to control the time of their execution.
  1351. <p>
  1352. If the same option is specified more than once within one address
  1353. specification, with equal or different values, the effect depends on the kind of option. Options
  1354. resulting in function calls like
  1355. <code>setsockopt()</code>
  1356. cause multiple
  1357. invocations. With options that set parameters for a required call like
  1358. <code>open()</code>
  1359. or set internal flags, the value of the last option occurrence is effective.
  1360. <p>
  1361. The existence or semantics of many options are system dependent. <strong>Socat</strong>
  1362. usually does NOT try to emulate missing libc or kernel features, it just
  1363. provides an
  1364. interface to the underlying system. So, if an operating system lacks a feature,
  1365. the related option is simply not available on this platform.
  1366. <p>
  1367. The following paragraphs introduce just the more common address options. For
  1368. a more comprehensive reference and to find information about canonical option
  1369. names, alias names, option phases, and platforms see file <strong>xio.help</strong>.
  1370. <br> <br>
  1371. <p>
  1372. <dl></dl><br>
  1373. <p>
  1374. <a name="GROUP_FD"></a><em><strong>FD option group</strong></em>
  1375. <p>
  1376. This option group contains options that are applied to a UN*X
  1377. style file descriptor, no matter how it was generated.
  1378. Because all current <strong>socat</strong> address types are file descriptor based, these
  1379. options may be applied to any address. <br>
  1380. Note: Some of these options are also member of another option group, that
  1381. provides another, non-fd based mechanism.
  1382. For these options, it depends on the actual address type and its option groups
  1383. which mechanism is used. The second, non-fd based mechanism is prioritized.
  1384. <dl>
  1385. <a name="OPTION_CLOEXEC"></a><p><dt><strong><strong><code>cloexec=&lt;bool&gt;</code></strong></strong><dd>
  1386. Sets the
  1387. <code>FD_CLOEXEC</code>
  1388. flag with the
  1389. <code>fcntl()</code>
  1390. system call to value
  1391. <a href="socat.html#TYPE_BOOL">&lt;bool&gt;</a>. If set,
  1392. the file descriptor is closed on
  1393. <code>exec()</code>
  1394. family function calls. <strong>Socat</strong>
  1395. internally handles
  1396. this flag for the fds it controls, so in most cases there will be no need to
  1397. apply this option.
  1398. <a name="OPTION_SETLK_WR"></a><p><dt><strong><strong><code>setlk</code></strong></strong><dd>
  1399. Tries to set a discretionary write lock to the whole file using the
  1400. <code>fcntl(fd,
  1401. F_SETLK, ...)</code>
  1402. system call. If the file is already locked, this call results
  1403. in an error.
  1404. On Linux, when the file permissions for group are "S" (g-x,g+s), and the
  1405. file system is locally mounted with the "mand" option, the lock is
  1406. mandatory, i.e. prevents other processes from opening the file.
  1407. <a name="OPTION_SETLKW_WR"></a><p><dt><strong><strong><code>setlkw</code></strong></strong><dd>
  1408. Tries to set a discretionary waiting write lock to the whole file using the
  1409. <code>fcntl(fd, F_SETLKW, ...)</code>
  1410. system call. If the file is already locked,
  1411. this call blocks.
  1412. See option <a href="socat.html#OPTION_SETLK_WR">setlk</a> for information about making this
  1413. lock mandatory.
  1414. <a name="OPTION_SETLK_RD"></a><p><dt><strong><strong><code>setlk-rd</code></strong></strong><dd>
  1415. Tries to set a discretionary read lock to the whole file using the
  1416. <code>fcntl(fd,
  1417. F_SETLK, ...)</code>
  1418. system call. If the file is already write locked, this call
  1419. results in an error.
  1420. See option <a href="socat.html#OPTION_SETLK_WR">setlk</a> for information about making this
  1421. lock mandatory.
  1422. <a name="OPTION_SETLKW_RD"></a><p><dt><strong><strong><code>setlkw-rd</code></strong></strong><dd>
  1423. Tries to set a discretionary waiting read lock to the whole file using the
  1424. <code>fcntl(fd, F_SETLKW, ...)</code>
  1425. system call. If the file is already write
  1426. locked, this call blocks.
  1427. See option <a href="socat.html#OPTION_SETLK_WR">setlk</a> for information about making this
  1428. lock mandatory.
  1429. <a name="OPTION_FLOCK_EX"></a><p><dt><strong><strong><code>flock-ex</code></strong></strong><dd>
  1430. Tries to set a blocking exclusive advisory lock to the file using the
  1431. <code>flock(fd, LOCK_EX)</code>
  1432. system call. <strong>Socat</strong> hangs in this call if the file
  1433. is locked by another process.
  1434. <a name="OPTION_FLOCK_EX_NB"></a><p><dt><strong><strong><code>flock-ex-nb</code></strong></strong><dd>
  1435. Tries to set a nonblocking exclusive advisory lock to the file using the
  1436. <code>flock(fd, LOCK_EX|LOCK_NB)</code>
  1437. system call. If the file is already locked,
  1438. this option results in an error.
  1439. <a name="OPTION_FLOCK_SH"></a><p><dt><strong><strong><code>flock-sh</code></strong></strong><dd>
  1440. Tries to set a blocking shared advisory lock to the file using the
  1441. <code>flock(fd, LOCK_SH)</code>
  1442. system call. <strong>Socat</strong> hangs in this call if the file
  1443. is locked by another process.
  1444. <a name="OPTION_FLOCK_SH_NB"></a><p><dt><strong><strong><code>flock-sh-nb</code></strong></strong><dd>
  1445. Tries to set a nonblocking shared advisory lock to the file using the
  1446. <code>flock(fd, LOCK_SH|LOCK_NB)</code>
  1447. system call. If the file is already locked,
  1448. this option results in an error.
  1449. <a name="OPTION_LOCK"></a><p><dt><strong><strong><code>lock</code></strong></strong><dd>
  1450. Sets a blocking lock on the file. Uses the setlk or flock mechanism
  1451. depending on availability on the particular platform. If both are available,
  1452. the POSIX variant (setlkw) is used.
  1453. <a name="OPTION_USER"></a><p><dt><strong><strong><code>user=&lt;user&gt;</code></strong></strong><dd>
  1454. Sets the <a href="socat.html#TYPE_USER">&lt;user&gt;</a> (owner) of the stream.
  1455. If the address is member of the NAMED option group,
  1456. <strong>socat</strong> uses the
  1457. <code>chown()</code>
  1458. system call after opening the
  1459. file or binding to the UNIX domain socket (race condition!).
  1460. Without filesystem entry, <strong>socat</strong> sets the user of the stream
  1461. using the
  1462. <code>fchown()</code>
  1463. system call.
  1464. These calls might require root privilege.
  1465. <a name="OPTION_USER_LATE"></a><p><dt><strong><strong><code>user-late=&lt;user&gt;</code></strong></strong><dd>
  1466. Sets the owner of the fd to <a href="socat.html#TYPE_USER">&lt;user&gt;</a> with the
  1467. <code>fchown()</code>
  1468. system call after opening
  1469. or connecting the channel.
  1470. This is useful only on file system entries.
  1471. <a name="OPTION_GROUP"></a><p><dt><strong><strong><code>group=&lt;group&gt;</code></strong></strong><dd>
  1472. Sets the <a href="socat.html#TYPE_GROUP">&lt;group&gt;</a> of the stream.
  1473. If the address is member of the NAMED option group,
  1474. <strong>socat</strong> uses the
  1475. <code>chown()</code>
  1476. system call after opening the
  1477. file or binding to the UNIX domain socket (race condition!).
  1478. Without filesystem entry, <strong>socat</strong> sets the group of the stream
  1479. with the
  1480. <code>fchown()</code>
  1481. system call.
  1482. These calls might require group membership or root privilege.
  1483. <a name="OPTION_GROUP_LATE"></a><p><dt><strong><strong><code>group-late=&lt;group&gt;</code></strong></strong><dd>
  1484. Sets the group of the fd to <a href="socat.html#TYPE_GROUP">&lt;group&gt;</a> with the
  1485. <code>fchown()</code>
  1486. system call after opening
  1487. or connecting the channel.
  1488. This is useful only on file system entries.
  1489. <a name="OPTION_MODE"></a><p><dt><strong><strong><code>mode=&lt;mode&gt;</code></strong></strong><dd>
  1490. Sets the &lt;mode&gt; [<a href="socat.html#TYPE_MODE_T">mode_t</a>] (permissions) of the stream.
  1491. If the address is member of the NAMED option group and
  1492. uses the
  1493. <code>open()</code>
  1494. or
  1495. <code>creat()</code>
  1496. call, the mode is applied with these.
  1497. If the address is member of the NAMED option group without using these
  1498. system calls, <strong>socat</strong> uses the
  1499. <code>chmod()</code>
  1500. system call after opening the
  1501. filesystem entry or binding to the UNIX domain socket (race condition!).
  1502. Otherwise, <strong>socat</strong> sets the mode of the stream
  1503. using
  1504. <code>fchmod()</code>
  1505. .
  1506. These calls might require ownership or root privilege.
  1507. <a name="OPTION_PERM_LATE"></a><p><dt><strong><strong><code>perm-late=&lt;mode&gt;</code></strong></strong><dd>
  1508. Sets the permissions of the fd to value &lt;mode&gt;
  1509. [<a href="socat.html#TYPE_MODE_T">mode_t</a>] using the
  1510. <code>fchmod()</code>
  1511. system call after
  1512. opening or connecting the channel.
  1513. This is useful only on file system entries.
  1514. <a name="OPTION_APPEND"></a><p><dt><strong><strong><code>append=&lt;bool&gt;</code></strong></strong><dd>
  1515. Always writes data to the actual end of file.
  1516. If the address is member of the OPEN option group,
  1517. <strong>socat</strong> uses the
  1518. <code>O_APPEND</code>
  1519. flag with the
  1520. <code>open()</code>
  1521. system call
  1522. (<a href="socat.html#EXAMPLE_OPTION_APPEND">example</a>).
  1523. Otherwise, <strong>socat</strong> applies the
  1524. <code>fcntl(fd, F_SETFL, O_APPEND)</code>
  1525. call.
  1526. <a name="OPTION_NONBLOCK"></a><p><dt><strong><strong><code>nonblock=&lt;bool&gt;</code></strong></strong><dd>
  1527. Tries to open or use file in nonblocking mode. Its only effects are that the
  1528. <code>connect()</code>
  1529. call of TCP addresses does not block, and that opening a
  1530. named pipe for reading does not block.
  1531. If the address is member of the OPEN option group,
  1532. <strong>socat</strong> uses the
  1533. <code>O_NONBLOCK</code>
  1534. flag with the
  1535. <code>open()</code>
  1536. system call.
  1537. Otherwise, <strong>socat</strong> applies the
  1538. <code>fcntl(fd, F_SETFL, O_NONBLOCK)</code>
  1539. call.
  1540. <a name="OPTION_O_BINARY"></a><p><dt><strong><strong><code>binary</code></strong></strong><dd>
  1541. Opens the file in binary mode to avoid implicit line terminator
  1542. conversions (Cygwin).
  1543. <a name="OPTION_O_TEXT"></a><p><dt><strong><strong><code>text</code></strong></strong><dd>
  1544. Opens the file in text mode to force implicit line terminator conversions
  1545. (Cygwin).
  1546. <a name="OPTION_O_NOINHERIT"></a><p><dt><strong><strong><code>noinherit</code></strong></strong><dd>
  1547. Does not keep this file open in a spawned process (Cygwin).
  1548. <a name="OPTION_COOL_WRITE"></a><p><dt><strong><strong><code>cool-write</code></strong></strong><dd>
  1549. Takes it easy when write fails with EPIPE or ECONNRESET and logs the message
  1550. with <em>notice</em> level instead of <em>error</em>.
  1551. This prevents the log file from being filled with useless error messages
  1552. when socat is used as a high volume server or proxy where clients often
  1553. abort the connection.<br>
  1554. This option is experimental.
  1555. <a name="OPTION_END_CLOSE"></a><p><dt><strong><strong><code>end-close</code></strong></strong><dd>
  1556. Changes the (address dependent) method of ending a connection to just close
  1557. the file descriptors. This is useful when the connection is to be reused by
  1558. or shared with other processes (<a href="socat.html#EXAMPLE_END_CLOSE">example</a>).<br>
  1559. Normally, socket connections will be ended with <code>shutdown(2)</code> which
  1560. terminates the socket even if it is shared by multiple processes.
  1561. <code>close(2)</code> "unlinks" the socket from the process but keeps it active as
  1562. long as there are still links from other processes.<br>
  1563. Similarly, when an address of type EXEC or SYSTEM is ended, socat usually
  1564. will explicitly kill the sub process. With this option, it will just close
  1565. the file descriptors.
  1566. <a name="OPTION_SHUT_NONE"></a><p><dt><strong><strong><code>shut-none</code></strong></strong><dd>
  1567. Changes the (address dependent) method of shutting down the write part of a
  1568. connection to not do anything.
  1569. <a name="OPTION_SHUT_DOWN"></a><p><dt><strong><strong><code>shut-down</code></strong></strong><dd>
  1570. Changes the (address dependent) method of shutting down the write part of a
  1571. connection to shutdown(fd, SHUT_WR). Is only useful with sockets.
  1572. <a name="OPTION_SHUT_CLOSE"></a><p><dt><strong><strong><code>shut-close</code></strong></strong><dd>
  1573. Changes the (address dependent) method of shutting down the write part of a
  1574. connection to close(fd).
  1575. <a name="OPTION_SHUT_NULL"></a><p><dt><strong><strong><code>shut-null</code></strong></strong><dd>
  1576. When one address indicates EOF, <strong>socat</strong> will send a zero sized packet to the
  1577. write channel of the other address to transfer the EOF condition. This is
  1578. useful with UDP and other datagram protocols. Has been tested against
  1579. netcat and socat with option <a href="socat.html#OPTION_NULL_EOF">null-eof</a>.
  1580. <a name="OPTION_NULL_EOF"></a><p><dt><strong><strong><code>null-eof</code></strong></strong><dd>
  1581. Normally <strong>socat</strong> will ignore empty (zero size payload) packets arriving on
  1582. datagram sockets, so it survives port scans. With this option <strong>socat</strong>
  1583. interprets empty datagram packets as EOF indicator (see
  1584. <a href="socat.html#OPTION_SHUT_NULL">shut-null</a>).
  1585. <a name="OPTION_IOCTL_VOID"></a><p><dt><strong><strong><code>ioctl-void=&lt;request&gt;</code></strong></strong><dd>
  1586. Calls <code>ioctl()</code> with the request value as second argument and NULL as
  1587. third argument. This option allows utilizing ioctls that are not
  1588. explicitly implemented in socat.
  1589. <a name="OPTION_IOCTL_INT"></a><p><dt><strong><strong><code>ioctl-int=&lt;request&gt;:&lt;value&gt;</code></strong></strong><dd>
  1590. Calls <code>ioctl()</code> with the request value as second argument and the integer
  1591. value as third argument.
  1592. <a name="OPTION_IOCTL_INTP"></a><p><dt><strong><strong><code>ioctl-intp=&lt;request&gt;:&lt;value&gt;</code></strong></strong><dd>
  1593. Calls <code>ioctl()</code> with the request value as second argument and a pointer to
  1594. the integer value as third argument.
  1595. <a name="OPTION_IOCTL_BIN"></a><p><dt><strong><strong><code>ioctl-bin=&lt;request&gt;:&lt;value&gt;</code></strong></strong><dd>
  1596. Calls <code>ioctl()</code> with the request value as second argument and a pointer to
  1597. the given data value as third argument. This data must be specified in
  1598. <a href="socat.html#TYPE_DATA">&lt;dalan&gt;</a> form.
  1599. <a name="OPTION_IOCTL_STRING"></a><p><dt><strong><strong><code>ioctl-string=&lt;request&gt;:&lt;value&gt;</code></strong></strong><dd>
  1600. Calls <code>ioctl()</code> with the request value as second argument and a pointer to
  1601. the given string as third argument.
  1602. <a href="socat.html#TYPE_DATA">&lt;dalan&gt;</a> form.
  1603. </dl>
  1604. <p>
  1605. <dl></dl><br>
  1606. <p>
  1607. <a name="GROUP_NAMED"></a><em><strong>NAMED option group</strong></em>
  1608. <p>
  1609. These options work on file system entries.<br>
  1610. See also options <a href="socat.html#OPTION_USER">user</a>, <a href="socat.html#OPTION_GROUP">group</a>, and
  1611. <a href="socat.html#OPTION_MODE">mode</a>.
  1612. <p>
  1613. <dl>
  1614. <a name="OPTION_USER_EARLY"></a><p><dt><strong><strong><code>user-early=&lt;user&gt;</code></strong></strong><dd>
  1615. Changes the <a href="socat.html#TYPE_USER">&lt;user&gt;</a> (owner) of the file system entry before
  1616. accessing it, using the
  1617. <code>chown()</code>
  1618. system call. This call might require root privilege.
  1619. <a name="OPTION_GROUP_EARLY"></a><p><dt><strong><strong><code>group-early=&lt;group&gt;</code></strong></strong><dd>
  1620. Changes the <a href="socat.html#TYPE_GROUP">&lt;group&gt;</a> of the file system entry before
  1621. accessing it, using the
  1622. <code>chown()</code>
  1623. system call. This call might require group membership or root
  1624. privilege.
  1625. <a name="OPTION_PERM_EARLY"></a><p><dt><strong><strong><code>perm-early=&lt;mode&gt;</code></strong></strong><dd>
  1626. Changes the &lt;mode&gt; [<a href="socat.html#TYPE_MODE_T">mode_t</a>] of the file system entry
  1627. before accessing it, using the
  1628. <code>chmod()</code>
  1629. system call. This call might require ownership or root
  1630. privilege.
  1631. <a name="OPTION_UMASK"></a><p><dt><strong><strong><code>umask=&lt;mode&gt;</code></strong></strong><dd>
  1632. Sets the umask of the process to &lt;mode&gt; [<a href="socat.html#TYPE_MODE_T">mode_t</a>] before
  1633. accessing the file system entry (useful
  1634. with UNIX domain sockets!). This call might affect all further operations
  1635. of the <strong>socat</strong> process!
  1636. <a name="OPTION_UNLINK_EARLY"></a><p><dt><strong><strong><code>unlink-early</code></strong></strong><dd>
  1637. Unlinks (removes) the file before opening it and even before applying
  1638. user-early etc.
  1639. <a name="OPTION_UNLINK"></a><p><dt><strong><strong><code>unlink</code></strong></strong><dd>
  1640. Unlinks (removes) the file before accessing it, but after user-early etc.
  1641. <a name="OPTION_UNLINK_LATE"></a><p><dt><strong><strong><code>unlink-late</code></strong></strong><dd>
  1642. Unlinks (removes) the file after opening it to make it inaccessible for
  1643. other processes after a short race condition.
  1644. <a name="OPTION_UNLINK_CLOSE"></a><p><dt><strong><strong><code>unlink-close</code></strong></strong><dd>
  1645. Removes the addresses file system entry when closing the address.
  1646. For <a href="socat.html#ADDRESS_NAMED_PIPE">named pipes</a>,
  1647. <a href="socat.html#ADDRESS_UNIX_LISTEN">listening unix domain sockets</a>,
  1648. and the <a href="socat.html#OPTION_SYMBOLIC_LINK">symbolic links</a> of <a href="socat.html#ADDRESS_PTY">pty addresses</a>,
  1649. the default is 1; for <a href="socat.html#ADDRESS_CREAT">created files</a>,
  1650. <a href="socat.html#ADDRESS_OPEN">opened files</a>,
  1651. <a href="socat.html#ADDRESS_GOPEN">generic opened files</a>, and
  1652. <a href="socat.html#ADDRESS_UNIX_CONNECT">client unix domain sockets</a> the default is 0.
  1653. </dl>
  1654. <p>
  1655. <dl></dl><br>
  1656. <p>
  1657. <a name="GROUP_OPEN"></a><em><strong>OPEN option group</strong></em>
  1658. <p>
  1659. The OPEN group options allow setting flags with the
  1660. <code>open()</code>
  1661. system call.
  1662. E.g., option `creat' sets the
  1663. <code>O_CREAT</code>
  1664. flag.<br>
  1665. See also options <a href="socat.html#OPTION_APPEND">append</a> and
  1666. <a href="socat.html#OPTION_NONBLOCK">nonblock</a>.
  1667. <dl>
  1668. <a name="OPTION_O_CREAT"></a><p><dt><strong><strong><code>creat=&lt;bool&gt;</code></strong></strong><dd>
  1669. Creates the file if it does not exist (<a href="socat.html#EXAMPLE_OPTION_CREAT">example</a>).
  1670. <a name="OPTION_DSYNC"></a><p><dt><strong><strong><code>dsync=&lt;bool&gt;</code></strong></strong><dd>
  1671. Blocks
  1672. <code>write()</code>
  1673. calls until metainfo is physically written to media.
  1674. <a name="OPTION_EXCL"></a><p><dt><strong><strong><code>excl=&lt;bool&gt;</code></strong></strong><dd>
  1675. With option creat, if file exists this is an error.
  1676. <a name="OPTION_LARGEFILE"></a><p><dt><strong><strong><code>largefile=&lt;bool&gt;</code></strong></strong><dd>
  1677. On 32 bit systems, allows a file larger than 2^31 bytes.
  1678. <a name="OPTION_O_NOATIME"></a><p><dt><strong><strong><code>noatime</code></strong></strong><dd>
  1679. Sets the O_NOATIME options, so reads do not change the access timestamp.
  1680. <a name="OPTION_NOCTTY"></a><p><dt><strong><strong><code>noctty=&lt;bool&gt;</code></strong></strong><dd>
  1681. Does not make this file the controlling terminal.
  1682. <a name="OPTION_NOFOLLOW"></a><p><dt><strong><strong><code>nofollow=&lt;bool&gt;</code></strong></strong><dd>
  1683. Does not follow symbolic links.
  1684. <a name="OPTION_NSHARE"></a><p><dt><strong><strong><code>nshare=&lt;bool&gt;</code></strong></strong><dd>
  1685. Does not allow sharing this file with other processes.
  1686. <a name="OPTION_RSHARE"></a><p><dt><strong><strong><code>rshare=&lt;bool&gt;</code></strong></strong><dd>
  1687. Does not allow other processes to open this file for writing.
  1688. <a name="OPTION_RSYNC"></a><p><dt><strong><strong><code>rsync=&lt;bool&gt;</code></strong></strong><dd>
  1689. Blocks
  1690. <code>write()</code>
  1691. until metainfo is physically written to media.
  1692. <a name="OPTION_SYNC"></a><p><dt><strong><strong><code>sync=&lt;bool&gt;</code></strong></strong><dd>
  1693. Blocks
  1694. <code>write()</code>
  1695. until data is physically written to media.
  1696. <a name="OPTION_RDONLY"></a><p><dt><strong><strong><code>rdonly=&lt;bool&gt;</code></strong></strong><dd>
  1697. Opens the file for reading only.
  1698. <a name="OPTION_WRONLY"></a><p><dt><strong><strong><code>wronly=&lt;bool&gt;</code></strong></strong><dd>
  1699. Opens the file for writing only.
  1700. <a name="OPTION_O_TRUNC"></a><p><dt><strong><strong><code>trunc</code></strong></strong><dd>
  1701. Truncates the file to size 0 during opening it.
  1702. </dl>
  1703. <p>
  1704. <dl></dl><br>
  1705. <p>
  1706. <a name="GROUP_REG"></a><em><strong>REG and BLK option group</strong></em>
  1707. <p>
  1708. These options are usually applied to a UN*X file descriptor, but their
  1709. semantics make sense only on a file supporting random access.
  1710. <dl>
  1711. <a name="OPTION_SEEK"></a><p><dt><strong><strong><code>seek=&lt;offset&gt;</code></strong></strong><dd>
  1712. Applies the
  1713. <code>lseek(fd, &lt;offset&gt;, SEEK_SET)</code>
  1714. (or
  1715. <code>lseek64</code>
  1716. ) system
  1717. call, thus positioning the file pointer absolutely to &lt;offset&gt;
  1718. [<a href="socat.html#TYPE_OFF">off_t</a> or <a href="socat.html#TYPE_OFF64">off64_t</a>]. Please note that a
  1719. missing value defaults to 1, not 0.
  1720. <a name="OPTION_SEEK_CUR"></a><p><dt><strong><strong><code>seek-cur=&lt;offset&gt;</code></strong></strong><dd>
  1721. Applies the
  1722. <code>lseek(fd, &lt;offset&gt;, SEEK_CUR)</code>
  1723. (or
  1724. <code>lseek64</code>
  1725. ) system
  1726. call, thus positioning the file pointer &lt;offset&gt; [<a href="socat.html#TYPE_OFF">off_t</a> or
  1727. <a href="socat.html#TYPE_OFF64">off64_t</a>] bytes relatively to its current position (which
  1728. is usually 0). Please note that a missing value defaults to 1, not 0.
  1729. <a name="OPTION_SEEK_END"></a><p><dt><strong><strong><code>seek-end=&lt;offset&gt;</code></strong></strong><dd>
  1730. Applies the
  1731. <code>lseek(fd, &lt;offset&gt;, SEEK_END)</code>
  1732. (or
  1733. <code>lseek64</code>
  1734. ) system
  1735. call, thus positioning the file pointer &lt;offset&gt; [<a href="socat.html#TYPE_OFF">off_t</a> or
  1736. <a href="socat.html#TYPE_OFF64">off64_t</a>] bytes relatively to the files current end. Please
  1737. note that a missing value defaults to 1, not 0.
  1738. <a name="OPTION_FTRUNCATE"></a><p><dt><strong><strong><code>ftruncate=&lt;offset&gt;</code></strong></strong><dd>
  1739. Applies the
  1740. <code>ftruncate(fd, &lt;offset&gt;)</code>
  1741. (or
  1742. <code>ftruncate64</code>
  1743. if available) system call, thus
  1744. truncating the file at the position &lt;offset&gt; [<a href="socat.html#TYPE_OFF">off_t</a> or
  1745. <a href="socat.html#TYPE_OFF64">off64_t</a>]. Please note that a missing value defaults to 1,
  1746. not 0.
  1747. <p>
  1748. <a name="OPTION_EXT2_SECRM_FL"></a><p><dt><strong><strong><code>secrm=&lt;bool&gt;</code></strong></strong><dd>
  1749. <a name="OPTION_EXT2_UNRM"></a><p><dt><strong><strong><code>unrm=&lt;bool&gt;</code></strong></strong><dd>
  1750. <a name="OPTION_EXT2_COMPR"></a><p><dt><strong><strong><code>compr=&lt;bool&gt;</code></strong></strong><dd>
  1751. <a name="OPTION_EXT2_SYNC"></a><p><dt><strong><strong><code>ext2-sync=&lt;bool&gt;</code></strong></strong><dd>
  1752. <a name="OPTION_EXT2_IMMUTABLE"></a><p><dt><strong><strong><code>immutable=&lt;bool&gt;</code></strong></strong><dd>
  1753. <a name="OPTION_EXT2_APPEND"></a><p><dt><strong><strong><code>ext2-append=&lt;bool&gt;</code></strong></strong><dd>
  1754. <a name="OPTION_EXT2_NODUMP"></a><p><dt><strong><strong><code>nodump=&lt;bool&gt;</code></strong></strong><dd>
  1755. <a name="OPTION_EXT2_NOATIME"></a><p><dt><strong><strong><code>ext2-noatime=&lt;bool&gt;</code></strong></strong><dd>
  1756. <a name="OPTION_EXT2_JOURNAL_DATA"></a><p><dt><strong><strong><code>journal-data=&lt;bool&gt;</code></strong></strong><dd>
  1757. <a name="OPTION_EXT2_NOTAIL"></a><p><dt><strong><strong><code>notail=&lt;bool&gt;</code></strong></strong><dd>
  1758. <a name="OPTION_EXT2_DIRSYNC"></a><p><dt><strong><strong><code>dirsync=&lt;bool&gt;</code></strong></strong><dd>
  1759. These options change non standard file attributes on operating systems and
  1760. file systems that support these features, like Linux with ext2fs,
  1761. ext3fs, or reiserfs. See man 1 chattr for information on these options.
  1762. Please note that there might be a race condition between creating the file
  1763. and applying these options.
  1764. </dl>
  1765. <p>
  1766. <dl></dl><br>
  1767. <p>
  1768. <a name="GROUP_PROCESS"></a><em><strong>PROCESS option group</strong></em>
  1769. <p>
  1770. Options of this group change the process properties instead of just affecting
  1771. one data channel.
  1772. For EXEC and SYSTEM addresses and for LISTEN and CONNECT type addresses with
  1773. option FORK,
  1774. these options apply to the child processes instead of the main socat process.
  1775. <dl>
  1776. <a name="OPTION_CHROOT"></a><p><dt><strong><strong><code>chroot=&lt;directory&gt;</code></strong></strong><dd>
  1777. Performs a
  1778. <code>chroot()</code>
  1779. operation to <a href="socat.html#TYPE_DIRECTORY">&lt;directory&gt;</a>
  1780. after processing the address (<a href="socat.html#EXAMPLE_OPTION_CHROOT">example</a>). This call might require root privilege.
  1781. <a name="OPTION_CHROOT_EARLY"></a><p><dt><strong><strong><code>chroot-early=&lt;directory&gt;</code></strong></strong><dd>
  1782. Performs a
  1783. <code>chroot()</code>
  1784. operation to <a href="socat.html#TYPE_DIRECTORY">&lt;directory&gt;</a>
  1785. before opening the address. This call might require root privilege.
  1786. <a name="OPTION_SETGID"></a><p><dt><strong><strong><code>setgid=&lt;group&gt;</code></strong></strong><dd>
  1787. Changes the primary <a href="socat.html#TYPE_GROUP">&lt;group&gt;</a> of the process after
  1788. processing the address. This call might require root privilege. Please note
  1789. that this option does not drop other group related privileges.
  1790. <a name="OPTION_SETGID_EARLY"></a><p><dt><strong><strong><code>setgid-early=&lt;group&gt;</code></strong></strong><dd>
  1791. Like <a href="socat.html#OPTION_SETGID">setgit</a> but is performed before opening the address.
  1792. <a name="OPTION_SETUID"></a><p><dt><strong><strong><code>setuid=&lt;user&gt;</code></strong></strong><dd>
  1793. Changes the <a href="socat.html#TYPE_USER">&lt;user&gt;</a> (owner) of the process after processing
  1794. the address. This call might require root privilege. Please note that this
  1795. option does not drop group related privileges. Check if option
  1796. <a href="socat.html#OPTION_SUBSTUSER">su</a> better fits your needs.
  1797. <a name="OPTION_SETUID_EARLY"></a><p><dt><strong><strong><code>setuid-early=&lt;user&gt;</code></strong></strong><dd>
  1798. Like <a href="socat.html#OPTION_SETUID">setuid</a> but is performed before opening the
  1799. address.
  1800. <a name="OPTION_SUBSTUSER"></a><p><dt><strong><strong><code>su=&lt;user&gt;</code></strong></strong><dd>
  1801. Changes the <a href="socat.html#TYPE_USER">&lt;user&gt;</a> (owner) and groups of the process after
  1802. processing the address (<a href="socat.html#EXAMPLE_OPTION_SUBSTUSER">example</a>). This call might require root privilege.
  1803. <a name="OPTION_SUBSTUSER_DELAYED"></a><p><dt><strong><strong><code>su-d=&lt;user&gt;</code></strong></strong><dd>
  1804. Short name for <code>substuser-delayed</code>.
  1805. Changes the <a href="socat.html#TYPE_USER">&lt;user&gt;</a>
  1806. (owner) and groups of the process after processing the address (<a href="socat.html#EXAMPLE_OPTION_SUBSTUSER_DELAYED">example</a>).
  1807. The user and his groups are retrieved <em>before</em> a possible
  1808. <code>chroot()</code>
  1809. . This call might require root privilege.
  1810. <a name="OPTION_SETPGID"></a><p><dt><strong><strong><code>setpgid=&lt;pid_t&gt;</code></strong></strong><dd>
  1811. Makes the process a member of the specified process group
  1812. <a href="socat.html#TYPE_PID_T">&lt;pid_t&gt;</a>. If no value
  1813. is given, or if the value is 0 or 1, the process becomes leader of a new
  1814. process group.
  1815. <a name="OPTION_SETSID"></a><p><dt><strong><strong><code>setsid</code></strong></strong><dd>
  1816. Makes the process the leader of a new session (<a href="socat.html#EXAMPLE_OPTION_SETSID">example</a>).
  1817. </dl>
  1818. <p>
  1819. <dl></dl><br>
  1820. <p>
  1821. <a name="GROUP_READLINE"></a><em><strong>READLINE option group</strong></em>
  1822. <p>
  1823. These options apply to the readline address type.
  1824. <dl>
  1825. <a name="OPTION_HISTORY"></a><p><dt><strong><strong><code>history=&lt;filename&gt;</code></strong></strong><dd>
  1826. Reads and writes history from/to <a href="socat.html#TYPE_FILENAME">&lt;filename&gt;</a> (<a href="socat.html#EXAMPLE_OPTION_HISTORY">example</a>).
  1827. <a name="OPTION_NOPROMPT"></a><p><dt><strong><strong><code>noprompt</code></strong></strong><dd>
  1828. Since version 1.4.0, socat per default tries to determine a prompt -
  1829. that is then passed to the readline call - by remembering the last
  1830. incomplete line of the output. With this option, socat does not pass a
  1831. prompt to readline, so it begins line editing in the first column
  1832. of the terminal.
  1833. <a name="OPTION_NOECHO"></a><p><dt><strong><strong><code>noecho=&lt;pattern&gt;</code></strong></strong><dd>
  1834. Specifies a regular pattern for a prompt that prevents the following input
  1835. line from being displayed on the screen and from being added to the history.
  1836. The prompt is defined as the text that was output to the readline address
  1837. after the lastest newline character and before an input character was
  1838. typed. The pattern is a regular expression, e.g.
  1839. "^[Pp]assword:.*$" or "([Uu]ser:|[Pp]assword:)". See regex(7) for details.
  1840. (<a href="socat.html#EXAMPLE_OPTION_NOECHO">example</a>)
  1841. <a name="OPTION_PROMPT"></a><p><dt><strong><strong><code>prompt=&lt;string&gt;</code></strong></strong><dd>
  1842. Passes the string as prompt to the readline function. readline prints this
  1843. prompt when stepping through the history. If this string matches a constant
  1844. prompt issued by an interactive program on the other socat address,
  1845. consistent look and feel can be achieved.
  1846. </dl>
  1847. <p>
  1848. <dl></dl><br>
  1849. <p>
  1850. <a name="GROUP_APPLICATION"></a><em><strong>APPLICATION option group</strong></em>
  1851. <p>
  1852. This group contains options that work at data level.
  1853. Note that these options only apply to the "raw" data transferred by socat,
  1854. but not to protocol data used by addresses like
  1855. <a href="socat.html#ADDRESS_PROXY_CONNECT">PROXY</a>.
  1856. <dl>
  1857. <a name="OPTION_CR"></a><p><dt><strong><strong><code>cr</code></strong></strong><dd>
  1858. Converts the default line termination character NL ('\n', 0x0a) to/from CR
  1859. ('\r', 0x0d) when writing/reading on this channel.
  1860. <a name="OPTION_CRNL"></a><p><dt><strong><strong><code>crnl</code></strong></strong><dd>
  1861. Converts the default line termination character NL ('\n', 0x0a) to/from CRNL
  1862. ("\r\n", 0x0d0a) when writing/reading on this channel (<a href="socat.html#EXAMPLE_OPTION_CRNL">example</a>).
  1863. Note: socat simply strips all CR characters.
  1864. <a name="OPTION_IGNOREEOF"></a><p><dt><strong><strong><code>ignoreeof</code></strong></strong><dd>
  1865. When EOF occurs on this channel, <strong>socat</strong> ignores it and tries to read more
  1866. data (like "tail -f") (<a href="socat.html#EXAMPLE_OPTION_IGNOREEOF">example</a>).
  1867. <a name="OPTION_READBYTES"></a><p><dt><strong><strong><code>readbytes=&lt;bytes&gt;</code></strong></strong><dd>
  1868. <strong>socat</strong> reads only so many bytes from this address (the address provides
  1869. only so many bytes for transfer and pretends to be at EOF afterwards).
  1870. Must be greater than 0.
  1871. <a name="OPTION_LOCKFILE"></a><p><dt><strong><strong><code>lockfile=&lt;filename&gt;</code></strong></strong><dd>
  1872. If lockfile exists, exits with error. If lockfile does not exist, creates it
  1873. and continues, unlinks lockfile on exit.
  1874. <a name="OPTION_WAITLOCK"></a><p><dt><strong><strong><code>waitlock=&lt;filename&gt;</code></strong></strong><dd>
  1875. If lockfile exists, waits until it disappears. When lockfile does not exist,
  1876. creates it and continues, unlinks lockfile on exit.
  1877. <a name="OPTION_ESCAPE"></a><p><dt><strong><strong><code>escape=&lt;int&gt;</code></strong></strong><dd>
  1878. Specifies the numeric code of a character that triggers EOF on the input
  1879. stream. It is useful with a terminal in raw mode
  1880. (<a href="socat.html#EXAMPLE_OPTION_ESCAPE">example</a>).
  1881. </dl>
  1882. <p>
  1883. <dl></dl><br>
  1884. <p>
  1885. <a name="GROUP_SOCKET"></a><em><strong>SOCKET option group</strong></em>
  1886. <p>
  1887. These options are intended for all kinds of sockets, e.g. IP or UNIX domain. Most are applied with a
  1888. <code>setsockopt()</code>
  1889. call.
  1890. <dl>
  1891. <a name="OPTION_BIND"></a><p><dt><strong><strong><code>bind=&lt;sockname&gt;</code></strong></strong><dd>
  1892. Binds the socket to the given socket address using the
  1893. <code>bind()</code>
  1894. system
  1895. call. The form of &lt;sockname&gt; is socket domain dependent:
  1896. IP4 and IP6 allow the form [hostname|hostaddress][:(service|port)] (<a href="socat.html#EXAMPLE_OPTION_BIND_TCP4">example</a>),
  1897. UNIX domain sockets require <a href="socat.html#TYPE_FILENAME">&lt;filename&gt;</a>.
  1898. <a name="OPTION_CONNECT_TIMEOUT"></a><p><dt><strong><strong><code>connect-timeout=&lt;seconds&gt;</code></strong></strong><dd>
  1899. Abort the connection attempt after &lt;seconds&gt; [<a href="socat.html#TYPE_TIMEVAL">timeval</a>]
  1900. with error status.
  1901. <a name="OPTION_SO_BINDTODEVICE"></a><p><dt><strong><strong><code>so-bindtodevice=&lt;interface&gt;</code></strong></strong><dd>
  1902. Binds the socket to the given <a href="socat.html#TYPE_INTERFACE">&lt;interface&gt;</a>.
  1903. This option might require root privilege.
  1904. <a name="OPTION_SO_BROADCAST"></a><p><dt><strong><strong><code>broadcast</code></strong></strong><dd>
  1905. For datagram sockets, allows sending to broadcast addresses and receiving
  1906. packets addressed to broadcast addresses.
  1907. <a name="OPTION_DEBUG"></a><p><dt><strong><strong><code>debug</code></strong></strong><dd>
  1908. Enables socket debugging.
  1909. <a name="OPTION_DONTROUTE"></a><p><dt><strong><strong><code>dontroute</code></strong></strong><dd>
  1910. Only communicates with directly connected peers, does not use routers.
  1911. <a name="OPTION_KEEPALIVE"></a><p><dt><strong><strong><code>keepalive</code></strong></strong><dd>
  1912. Enables sending keepalives on the socket.
  1913. <a name="OPTION_LINGER"></a><p><dt><strong><strong><code>linger=&lt;seconds&gt;</code></strong></strong><dd>
  1914. Blocks
  1915. <code>shutdown()</code>
  1916. or
  1917. <code>close()</code>
  1918. until data transfers have finished
  1919. or the given timeout [<a href="socat.html#TYPE_INT">int</a>] expired.
  1920. <a name="OPTION_OOBINLINE"></a><p><dt><strong><strong><code>oobinline</code></strong></strong><dd>
  1921. Places out-of-band data in the input data stream.
  1922. <a name="OPTION_PRIORITY"></a><p><dt><strong><strong><code>priority=&lt;priority&gt;</code></strong></strong><dd>
  1923. Sets the protocol defined &lt;priority&gt; [<a href="socat.html#TYPE_INT">&lt;int&gt;</a>] for outgoing
  1924. packets.
  1925. <a name="OPTION_RCVBUF"></a><p><dt><strong><strong><code>rcvbuf=&lt;bytes&gt;</code></strong></strong><dd>
  1926. Sets the size of the receive buffer after the
  1927. <code>socket()</code>
  1928. call to
  1929. &lt;bytes&gt; [<a href="socat.html#TYPE_INT">int</a>]. With TCP
  1930. sockets, this value corresponds to the socket's maximal window size.
  1931. <a name="OPTION_RCVBUF_LATE"></a><p><dt><strong><strong><code>rcvbuf-late=&lt;bytes&gt;</code></strong></strong><dd>
  1932. Sets the size of the receive buffer when the socket is already
  1933. connected to &lt;bytes&gt; [<a href="socat.html#TYPE_INT">int</a>].
  1934. With TCP sockets, this value corresponds to the socket's
  1935. maximal window size.
  1936. <a name="OPTION_RCVLOWAT"></a><p><dt><strong><strong><code>rcvlowat=&lt;bytes&gt;</code></strong></strong><dd>
  1937. Specifies the minimum number of received bytes [<a href="socat.html#TYPE_INT">int</a>] until
  1938. the socket layer will pass the buffered data to <strong>socat</strong>.
  1939. <a name="OPTION_REUSEADDR"></a><p><dt><strong><strong><code>reuseaddr</code></strong></strong><dd>
  1940. Allows other sockets to bind to an address even if parts of it (e.g. the
  1941. local port) are already in use by <strong>socat</strong> (<a href="socat.html#EXAMPLE_OPTION_REUSEADDR">example</a>).
  1942. <a name="OPTION_SNDBUF"></a><p><dt><strong><strong><code>sndbuf=&lt;bytes&gt;</code></strong></strong><dd>
  1943. Sets the size of the send buffer after the
  1944. <code>socket()</code>
  1945. call to
  1946. &lt;bytes&gt; [<a href="socat.html#TYPE_INT">int</a>].
  1947. <a name="OPTION_SNDBUF_LATE"></a><p><dt><strong><strong><code>sndbuf-late=&lt;bytes&gt;</code></strong></strong><dd>
  1948. Sets the size of the send buffer when the socket is connected to
  1949. &lt;bytes&gt; [<a href="socat.html#TYPE_INT">int</a>].
  1950. <a name="OPTION_SNDLOWAT"></a><p><dt><strong><strong><code>sndlowat=&lt;bytes&gt;</code></strong></strong><dd>
  1951. Specifies the minimum number of bytes in the send buffer until the socket
  1952. layer will send the data to &lt;bytes&gt; [<a href="socat.html#TYPE_INT">int</a>].
  1953. <a name="OPTION_PROTOCOL_FAMILY"></a><p><dt><strong><strong><code>pf=&lt;string&gt;</code></strong></strong><dd>
  1954. Forces the use of the specified IP version or protocol. &lt;string&gt; can be
  1955. something like "ip4" or "ip6". The resulting value is
  1956. used as first argument to the
  1957. <code>socket()</code>
  1958. or
  1959. <code>socketpair()</code>
  1960. calls.
  1961. This option affects address resolution and the required syntax of bind and
  1962. range options.
  1963. <a name="OPTION_SO_TYPE"></a><p><dt><strong><strong><code>type=&lt;type&gt;</code></strong></strong><dd>
  1964. Sets the type of the socket, specified as second argument to the
  1965. <code>socket()</code>
  1966. or
  1967. <code>socketpair()</code>
  1968. calls, to &lt;type&gt;
  1969. [<a href="socat.html#TYPE_INT">int</a>]. Address resolution is not affected by this option.
  1970. Under Linux, 1 means stream oriented socket, 2 means datagram socket, and 3
  1971. means raw socket.
  1972. <a name="OPTION_SO_PROTOTYPE"></a><p><dt><strong><strong><code>prototype</code></strong></strong><dd>
  1973. Sets the protocol of the socket, specified as third argument to the
  1974. <code>socket()</code>
  1975. or
  1976. <code>socketpair()</code>
  1977. calls, to &lt;prototype&gt;
  1978. [<a href="socat.html#TYPE_INT">int</a>]. Address resolution is not affected by this option.
  1979. 6 means TCP, 17 means UDP.
  1980. <a name="OPTION_REUSEPORT"></a><p><dt><strong><strong><code>reuseport</code></strong></strong><dd>
  1981. Set the
  1982. <code>SO_REUSEPORT</code>
  1983. socket option.
  1984. <a name="OPTION_SO_TIMESTAMP"></a><p><dt><strong><strong><code>so-timestamp</code></strong></strong><dd>
  1985. Sets the SO_TIMESTAMP socket option. This enables receiving and logging of
  1986. timestamp ancillary messages.
  1987. <a name="OPTION_SETSOCKOPT_INT"></a><p><dt><strong><strong><code>setsockopt-int=&lt;level&gt;:&lt;optname&gt;:&lt;optval&gt;</code></strong></strong><dd>
  1988. Invokes <code>setsockopt()</code> for the socket with the given parameters. <code>level</code>
  1989. [<a href="socat.html#TYPE_INT">int</a>] is used as second argument to <code>setsockopt()</code> and
  1990. specifies the layer, e.g. SOL_TCP for TCP (6 on Linux), or SOL_SOCKET for
  1991. the socket layer (1 on Linux). <code>optname</code> [<a href="socat.html#TYPE_INT">int</a>] is the
  1992. third argument to <code>setsockopt()</code> and tells which socket option is to be
  1993. set. For the actual numbers you might have to look up the appropriate include
  1994. files of your system. The 4th <code>setsockopt()</code> parameter, <code>value</code>
  1995. [<a href="socat.html#TYPE_INT">int</a>], is passed to the function per pointer, and for the
  1996. length parameter sizeof(int) is taken implicitely.
  1997. <a name="OPTION_SETSOCKOPT_BIN"></a><p><dt><strong><strong><code>setsockopt-bin=&lt;level&gt;:&lt;optname&gt;:&lt;optval&gt;</code></strong></strong><dd>
  1998. Like <code>setsockopt-int</code>, but &lt;optval&gt; must be provided in
  1999. <a href="socat.html#TYPE_DATA">dalan</a> format and specifies an arbitrary sequence of bytes;
  2000. the length parameter is automatically derived from the data.
  2001. <a name="OPTION_SETSOCKOPT_STRING"></a><p><dt><strong><strong><code>setsockopt-string=&lt;level&gt;:&lt;optname&gt;:&lt;optval&gt;</code></strong></strong><dd>
  2002. Like <code>setsockopt-int</code>, but &lt;optval&gt; must be a <a href="socat.html#TYPE_STRING">string</a>.
  2003. This string is passed to the function with trailing null character, and the
  2004. length parameter is automatically derived from the data.
  2005. </dl>
  2006. <p>
  2007. <dl></dl><br>
  2008. <p>
  2009. <a name="GROUP_SOCK_UNIX"></a><em><strong>UNIX option group</strong></em>
  2010. <p>
  2011. These options apply to UNIX domain based addresses.
  2012. <dl>
  2013. <a name="OPTION_UNIX_TIGHTSOCKLEN"></a><p><dt><strong><strong><code>unix-tightsocklen=[0|1]</code></strong></strong><dd>
  2014. On socket operations, pass a socket address length that does not include the
  2015. whole
  2016. <code>struct sockaddr_un</code>
  2017. record but (besides other components) only
  2018. the relevant part of the filename or abstract string. Default is 1.
  2019. </dl>
  2020. <p>
  2021. <a name="GROUP_IP4"></a>
  2022. <a name="GROUP_IP"></a><em><strong>IP4 and IP6 option groups</strong></em>
  2023. <p>
  2024. These options can be used with IPv4 and IPv6 based sockets.
  2025. <dl>
  2026. <a name="OPTION_TOS"></a><p><dt><strong><strong><code>tos=&lt;tos&gt;</code></strong></strong><dd>
  2027. Sets the TOS (type of service) field of outgoing packets to &lt;tos&gt;
  2028. [<a href="socat.html#TYPE_BYTE">byte</a>] (see RFC 791).
  2029. <a name="OPTION_TTL"></a><p><dt><strong><strong><code>ttl=&lt;ttl&gt;</code></strong></strong><dd>
  2030. Sets the TTL (time to live) field of outgoing packets to &lt;ttl&gt;
  2031. [<a href="socat.html#TYPE_BYTE">byte</a>].
  2032. <a name="OPTION_IPOPTIONS"></a><p><dt><strong><strong><code>ip-options=&lt;data&gt;</code></strong></strong><dd>
  2033. Sets IP options like source routing. Must be given in binary form,
  2034. recommended format is a leading "x" followed by an even number of hex
  2035. digits. This option may be used multiple times, data are appended.
  2036. E.g., to connect to host 10.0.0.1 via some gateway using a loose source
  2037. route, use the gateway as address parameter and set a loose source route
  2038. using the option
  2039. <code>ip-options=x8307040a000001</code>
  2040. .<br>
  2041. IP options are defined in RFC 791. <br>
  2042. <a name="OPTION_MTUDISCOVER"></a><p><dt><strong><strong><code>mtudiscover=&lt;0|1|2&gt;</code></strong></strong><dd>
  2043. Takes 0, 1, 2 to never, want, or always use path MTU discover on this
  2044. socket.
  2045. <a name="OPTION_IP_PKTINFO"></a><p><dt><strong><strong><code>ip-pktinfo</code></strong></strong><dd>
  2046. Sets the IP_PKTINFO socket option. This enables receiving and logging of
  2047. ancillary messages containing destination address and interface (Linux)
  2048. (<a href="socat.html#EXAMPLE_ANCILLARY">example</a>).
  2049. <a name="OPTION_IP_RECVERR"></a><p><dt><strong><strong><code>ip-recverr</code></strong></strong><dd>
  2050. Sets the IP_RECVERR socket option. This enables receiving and logging of
  2051. ancillary messages containing detailed error information.
  2052. <a name="OPTION_IP_RECVOPTS"></a><p><dt><strong><strong><code>ip-recvopts</code></strong></strong><dd>
  2053. Sets the IP_RECVOPTS socket option. This enables receiving and logging of IP
  2054. options ancillary messages (Linux, *BSD).
  2055. <a name="OPTION_IP_RECVTOS"></a><p><dt><strong><strong><code>ip-recvtos</code></strong></strong><dd>
  2056. Sets the IP_RECVTOS socket option. This enables receiving and logging of TOS
  2057. (type of service) ancillary messages (Linux).
  2058. <a name="OPTION_IP_RECVTTL"></a><p><dt><strong><strong><code>ip-recvttl</code></strong></strong><dd>
  2059. Sets the IP_RECVTTL socket option. This enables receiving and logging of TTL
  2060. (time to live) ancillary messages (Linux, *BSD).
  2061. <a name="OPTION_IP_RECVDSTADDR"></a><p><dt><strong><strong><code>ip-recvdstaddr</code></strong></strong><dd>
  2062. Sets the IP_RECVDSTADDR socket option. This enables receiving and logging of
  2063. ancillary messages containing destination address (*BSD)
  2064. (<a href="socat.html#EXAMPLE_ANCILLARY">example</a>).
  2065. <a name="OPTION_IP_RECVIF"></a><p><dt><strong><strong><code>ip-recvif</code></strong></strong><dd>
  2066. Sets the IP_RECVIF socket option. This enables receiving and logging of
  2067. interface ancillary messages (*BSD) (<a href="socat.html#EXAMPLE_ANCILLARY">example</a>).
  2068. <a name="OPTION_IP_ADD_MEMBERSHIP"></a>
  2069. <p><dt><strong><strong><code>ip-add-membership=&lt;multicast-address:interface-address&gt;</code></strong></strong><dd>
  2070. <p><dt><strong><strong><code>ip-add-membership=&lt;multicast-address:interface-name&gt;</code></strong></strong><dd>
  2071. <p><dt><strong><strong><code>ip-add-membership=&lt;multicast-address:interface-index&gt;</code></strong></strong><dd>
  2072. <p><dt><strong><strong><code>ip-add-membership=&lt;multicast-address:interface-address:interface-name&gt;</code></strong></strong><dd>
  2073. <p><dt><strong><strong><code>ip-add-membership=&lt;multicast-address:interface-address:interface-index&gt;</code></strong></strong><dd>
  2074. Makes the socket member of the specified multicast group. This is currently
  2075. only implemented for IPv4. The option takes the IP address of the multicast
  2076. group and info about the desired network interface. The most common syntax
  2077. is the first one, while the others are only available on systems that
  2078. provide <code>struct mreqn</code> (Linux).<br>
  2079. The indices of active network interfaces can be shown using the utility
  2080. <strong>procan</strong>.
  2081. <a name="OPTION_IP_MULTICAST_IF"></a>
  2082. <p><dt><strong><strong><code>ip-multicast-if=&lt;hostname&gt;</code></strong></strong><dd>
  2083. Specifies hostname or address of the network interface to be used for
  2084. multicast traffic.
  2085. <a name="OPTION_IP_MULTICAST_LOOP"></a>
  2086. <p><dt><strong><strong><code>ip-multicast-loop=&lt;bool&gt;</code></strong></strong><dd>
  2087. Specifies if outgoing multicast traffic should loop back to the interface.
  2088. <a name="OPTION_IP_MULTICAST_TTL"></a>
  2089. <p><dt><strong><strong><code>ip-multicast-ttl=&lt;byte&gt;</code></strong></strong><dd>
  2090. Sets the TTL used for outgoing multicast traffic. Default is 1.
  2091. <a name="OPTION_RES_DEBUG"></a><p><dt><strong><strong><code>res-debug</code></strong></strong><dd>
  2092. <a name="OPTION_RES_AAONLY"></a><p><dt><strong><strong><code>res-aaonly</code></strong></strong><dd>
  2093. <a name="OPTION_RES_USEVC"></a><p><dt><strong><strong><code>res-usevc</code></strong></strong><dd>
  2094. <a name="OPTION_RES_PRIMARY"></a><p><dt><strong><strong><code>res-primary</code></strong></strong><dd>
  2095. <a name="OPTION_RES_IGNTC"></a><p><dt><strong><strong><code>res-igntc</code></strong></strong><dd>
  2096. <a name="OPTION_RES_RECURSE"></a><p><dt><strong><strong><code>res-recurse</code></strong></strong><dd>
  2097. <a name="OPTION_RES_DEFNAMES"></a><p><dt><strong><strong><code>res-defnames</code></strong></strong><dd>
  2098. <a name="OPTION_RES_STAYOPEN"></a><p><dt><strong><strong><code>res-stayopen</code></strong></strong><dd>
  2099. <a name="OPTION_RES_DNSRCH"></a><p><dt><strong><strong><code>res-dnsrch</code></strong></strong><dd>
  2100. These options set the corresponding resolver (name resolution) option flags.
  2101. Append "=0" to clear a default option. See man resolver(5) for more
  2102. information on these options. Note: these options are valid only for the
  2103. address they are applied to.
  2104. <p>
  2105. </dl>
  2106. <p>
  2107. <dl></dl><br>
  2108. <p>
  2109. <a name="GROUP_IP6"></a><em><strong>IP6 option group</strong></em>
  2110. <p>
  2111. These options can only be used on IPv6 based sockets. See <a href="socat.html#GROUP_IP">IP
  2112. options</a> for options that can be applied to both IPv4 and IPv6
  2113. sockets.
  2114. <dl>
  2115. <a name="OPTION_IPV6_V6ONLY"></a><p><dt><strong><strong><code>ipv6only=&lt;bool&gt;</code></strong></strong><dd>
  2116. Sets the IPV6_V6ONLY socket option. If 0, the TCP stack will also accept
  2117. connections using IPv4 protocol on the same port. The default is system
  2118. dependent.
  2119. <a name="OPTION_IPV6_RECVDSTOPTS"></a><p><dt><strong><strong><code>ipv6-recvdstopts</code></strong></strong><dd>
  2120. Sets the IPV6_RECVDSTOPTS socket option. This enables receiving and logging
  2121. of ancillary messages containing the destination options.
  2122. <a name="OPTION_IPV6_RECVHOPLIMIT"></a><p><dt><strong><strong><code>ipv6-recvhoplimit</code></strong></strong><dd>
  2123. Sets the IPV6_RECVHOPLIMIT socket option. This enables receiving and logging
  2124. of ancillary messages containing the hoplimit.
  2125. <a name="OPTION_IPV6_RECVHOPOPTS"></a><p><dt><strong><strong><code>ipv6-recvhopopts</code></strong></strong><dd>
  2126. Sets the IPV6_RECVHOPOPTS socket option. This enables receiving and logging
  2127. of ancillary messages containing the hop options.
  2128. <a name="OPTION_IPV6_RECVPKTINFO"></a><p><dt><strong><strong><code>ipv6-recvpktinfo</code></strong></strong><dd>
  2129. Sets the IPV6_RECVPKTINFO socket option. This enables receiving and logging
  2130. of ancillary messages containing destination address and interface.
  2131. <a name="OPTION_IPV6_UNICAST_HOPS"></a><p><dt><strong><strong><code>ipv6-unicast-hops=link(TYPE_INT)(&lt;int&gt;)</code></strong></strong><dd>
  2132. Sets the IPV6_UNICAST_HOPS socket option. This sets the hop count limit
  2133. (TTL) for outgoing unicast packets.
  2134. <a name="OPTION_IPV6_RECVRTHDR"></a><p><dt><strong><strong><code>ipv6-recvrthdr</code></strong></strong><dd>
  2135. Sets the IPV6_RECVRTHDR socket option. This enables receiving and logging
  2136. of ancillary messages containing routing information.
  2137. <a name="OPTION_IPV6_TCLASS"></a><p><dt><strong><strong><code>ipv6-tclass</code></strong></strong><dd>
  2138. Sets the IPV6_TCLASS socket option. This sets the transfer class of outgoing
  2139. packets.
  2140. <a name="OPTION_IPV6_RECVTCLASS"></a><p><dt><strong><strong><code>ipv6-recvtclass</code></strong></strong><dd>
  2141. Sets the IPV6_RECVTCLASS socket option. This enables receiving and logging
  2142. of ancillary messages containing the transfer class.
  2143. </dl>
  2144. <p>
  2145. <dl></dl><br>
  2146. <p>
  2147. <a name="GROUP_TCP"></a><em><strong>TCP option group</strong></em>
  2148. <p>
  2149. These options may be applied to TCP sockets. They work by invoking
  2150. <code>setsockopt()</code>
  2151. with the appropriate parameters.
  2152. <dl>
  2153. <a name="OPTION_CORK"></a><p><dt><strong><strong><code>cork</code></strong></strong><dd>
  2154. Doesn't send packets smaller than MSS (maximal segment size).
  2155. <a name="OPTION_DEFER-ACCEPT"></a><p><dt><strong><strong><code>defer-accept</code></strong></strong><dd>
  2156. While listening, accepts connections only when data from the peer arrived.
  2157. <a name="OPTION_KEEPCNT"></a><p><dt><strong><strong><code>keepcnt=&lt;count&gt;</code></strong></strong><dd>
  2158. Sets the number of keepalives before shutting down the socket to
  2159. &lt;count&gt; [<a href="socat.html#TYPE_INT">int</a>].
  2160. <a name="OPTION_KEEPIDLE"></a><p><dt><strong><strong><code>keepidle=&lt;seconds&gt;</code></strong></strong><dd>
  2161. Sets the idle time before sending the first keepalive to &lt;seconds&gt;
  2162. [<a href="socat.html#TYPE_INT">int</a>].
  2163. <a name="OPTION_KEEPINTVL"></a><p><dt><strong><strong><code>keepintvl=&lt;seconds&gt;</code></strong></strong><dd>
  2164. Sets the interval between two keepalives to &lt;seconds&gt;
  2165. [<a href="socat.html#TYPE_INT">int</a>].
  2166. <a name="OPTION_LINGER2"></a><p><dt><strong><strong><code>linger2=&lt;seconds&gt;</code></strong></strong><dd>
  2167. Sets the time to keep the socket in FIN-WAIT-2 state to &lt;seconds&gt;
  2168. [<a href="socat.html#TYPE_INT">int</a>].
  2169. <a name="OPTION_MSS"></a><p><dt><strong><strong><code>mss=&lt;bytes&gt;</code></strong></strong><dd>
  2170. Sets the MSS (maximum segment size) after the
  2171. <code>socket()</code>
  2172. call to &lt;bytes&gt;
  2173. [<a href="socat.html#TYPE_INT">int</a>]. This
  2174. value is then proposed to the peer with the SYN or SYN/ACK packet
  2175. (<a href="socat.html#EXAMPLE_OPTION_MSS">example</a>).
  2176. <a name="OPTION_MSS_LATE"></a><p><dt><strong><strong><code>mss-late=&lt;bytes&gt;</code></strong></strong><dd>
  2177. Sets the MSS of the socket after connection has been established to &lt;bytes&gt;
  2178. [<a href="socat.html#TYPE_INT">int</a>].
  2179. <a name="OPTION_NODELAY"></a><p><dt><strong><strong><code>nodelay</code></strong></strong><dd>
  2180. Turns off the Nagle algorithm for measuring the RTT (round trip time).
  2181. <a name="OPTION_RFC1323"></a><p><dt><strong><strong><code>rfc1323</code></strong></strong><dd>
  2182. Enables RFC1323 TCP options: TCP window scale, round-trip time measurement
  2183. (RTTM), and protect against wrapped sequence numbers (PAWS) (AIX).
  2184. <a name="OPTION_STDURG"></a><p><dt><strong><strong><code>stdurg</code></strong></strong><dd>
  2185. Enables RFC1122 compliant urgent pointer handling (AIX).
  2186. <a name="OPTION_SYNCNT"></a><p><dt><strong><strong><code>syncnt=&lt;count&gt;</code></strong></strong><dd>
  2187. Sets the maximal number of SYN retransmits during connect to &lt;count&gt;
  2188. [<a href="socat.html#TYPE_INT">int</a>].
  2189. <a name="OPTION_TCP_MD5SIG"></a><p><dt><strong><strong><code>md5sig</code></strong></strong><dd>
  2190. Enables generation of MD5 digests on the packets (FreeBSD).
  2191. <a name="OPTION_TCP_NOOPT"></a><p><dt><strong><strong><code>noopt</code></strong></strong><dd>
  2192. Disables use of TCP options (FreeBSD, MacOSX).
  2193. <a name="OPTION_TCP_NOPUSH"></a><p><dt><strong><strong><code>nopush</code></strong></strong><dd>
  2194. sets the TCP_NOPUSH socket option (FreeBSD, MacOSX).
  2195. <a name="OPTION_TCP_SACK_DISABLE"></a><p><dt><strong><strong><code>sack-disable</code></strong></strong><dd>
  2196. Disables use the selective acknowledge feature (OpenBSD).
  2197. <a name="OPTION_TCP_SIGNATURE_ENABLE"></a><p><dt><strong><strong><code>signature-enable</code></strong></strong><dd>
  2198. Enables generation of MD5 digests on the packets (OpenBSD).
  2199. <a name="OPTION_TCP_ABORT_THRESHOLD"></a><p><dt><strong><strong><code>abort-threshold=&lt;milliseconds&gt;</code></strong></strong><dd>
  2200. Sets the time to wait for an answer of the peer on an established connection
  2201. (HP-UX).
  2202. <a name="OPTION_TCP_CONN_ABORT_THRESHOLD"></a><p><dt><strong><strong><code>conn-abort-threshold=&lt;milliseconds&gt;</code></strong></strong><dd>
  2203. Sets the time to wait for an answer of the server during the initial connect
  2204. (HP-UX).
  2205. <a name="OPTION_TCP_KEEPINIT"></a><p><dt><strong><strong><code>keepinit</code></strong></strong><dd>
  2206. Sets the time to wait for an answer of the server during connect() before
  2207. giving up. Value in half seconds, default is 150 (75s) (Tru64).
  2208. <a name="OPTION_TCP_PAWS"></a><p><dt><strong><strong><code>paws</code></strong></strong><dd>
  2209. Enables the "protect against wrapped sequence numbers" feature (Tru64).
  2210. <a name="OPTION_TCP_SACKENA"></a><p><dt><strong><strong><code>sackena</code></strong></strong><dd>
  2211. Enables selective acknowledge (Tru64).
  2212. <a name="OPTION_TCP_TSOPTENA"></a><p><dt><strong><strong><code>tsoptena</code></strong></strong><dd>
  2213. Enables the time stamp option that allows RTT recalculation on existing
  2214. connections (Tru64).
  2215. </dl>
  2216. <p>
  2217. <dl></dl><br>
  2218. <p>
  2219. <a name="GROUP_SCTP"></a><em><strong>SCTP option group</strong></em>
  2220. <p>
  2221. These options may be applied to SCTP stream sockets.
  2222. <dl>
  2223. <a name="OPTION_SCTP_NODELAY"></a><p><dt><strong><strong><code>sctp-nodelay</code></strong></strong><dd>
  2224. Sets the SCTP_NODELAY socket option that disables the Nagle algorithm.
  2225. <a name="OPTION_SCTP_MAXSEG"></a><p><dt><strong><strong><code>sctp-maxseg=&lt;bytes&gt;</code></strong></strong><dd>
  2226. Sets the SCTP_MAXSEG socket option to &lt;bytes&gt; [<a href="socat.html#TYPE_INT">int</a>]. This
  2227. value is then proposed to the peer with the SYN or SYN/ACK packet.
  2228. </dl>
  2229. <p>
  2230. <dl></dl><br>
  2231. <p>
  2232. <em><strong>UDP, TCP, and SCTP option groups</strong></em>
  2233. <p>
  2234. Here we find options that are related to the network port mechanism and thus
  2235. can be used with UDP, TCP, and SCTP client and server addresses.
  2236. <dl>
  2237. <a name="OPTION_SOURCEPORT"></a><p><dt><strong><strong><code>sourceport=&lt;port&gt;</code></strong></strong><dd>
  2238. For outgoing (client) TCP and UDP connections, it sets the source
  2239. <a href="socat.html#TYPE_PORT">&lt;port&gt;</a> using an extra
  2240. <code>bind()</code>
  2241. call.
  2242. With TCP or UDP listen addresses, socat immediately shuts down the
  2243. connection if the client does not use this sourceport (<a href="socat.html#EXAMPLE_OPTION_SOURCEPORT">example</a>).
  2244. <a name="OPTION_LOWPORT"></a><p><dt><strong><strong><code>lowport</code></strong></strong><dd>
  2245. Outgoing (client) TCP and UDP connections with this option use
  2246. an unused random source port between 640 and 1023 incl. On UNIX class operating
  2247. systems, this requires root privilege, and thus indicates that the
  2248. client process is authorized by local root.
  2249. TCP and UDP listen addresses with this option immediately shut down the
  2250. connection if the client does not use a sourceport &lt;= 1023.
  2251. This mechanism can provide limited authorization under some circumstances.
  2252. </dl>
  2253. <p>
  2254. <dl></dl><br>
  2255. <p>
  2256. <a name="GROUP_SOCKS"></a><em><strong>SOCKS option group</strong></em>
  2257. <p>
  2258. When using SOCKS type addresses, some socks specific options can be set.
  2259. <dl>
  2260. <a name="OPTION_SOCKSPORT"></a><p><dt><strong><strong><code>socksport=&lt;tcp service&gt;</code></strong></strong><dd>
  2261. Overrides the default "socks" service or port 1080 for the socks server
  2262. port with <a href="socat.html#TYPE_TCP_SERVICE">&lt;TCP service&gt;</a>.
  2263. <a name="OPTION_SOCKSUSER"></a><p><dt><strong><strong><code>socksuser=&lt;user&gt;</code></strong></strong><dd>
  2264. Sends the &lt;user&gt; [<a href="socat.html#TYPE_STRING">string</a>] in the username field to the
  2265. socks server. Default is the actual user name ($LOGNAME or $USER) (<a href="socat.html#EXAMPLE_OPTION_SOCKSUSER">example</a>).
  2266. </dl>
  2267. <p>
  2268. <dl></dl><br>
  2269. <p>
  2270. <a name="GROUP_HTTP"></a><em><strong>HTTP option group</strong></em>
  2271. <p>
  2272. Options that can be provided with HTTP type addresses. The only HTTP address
  2273. currently implemented is <a href="socat.html#ADDRESS_PROXY_CONNECT">proxy-connect</a>.
  2274. <p>
  2275. <dl>
  2276. <a name="OPTION_PROXYPORT"></a><p><dt><strong><strong><code>proxyport=&lt;TCP service&gt;</code></strong></strong><dd>
  2277. Overrides the default HTTP proxy port 8080 with
  2278. <a href="socat.html#TYPE_TCP_SERVICE">&lt;TCP service&gt;</a>.
  2279. <a name="OPTION_IGNORECR"></a><p><dt><strong><strong><code>ignorecr</code></strong></strong><dd>
  2280. The HTTP protocol requires the use of CR+NL as line terminator. When a proxy
  2281. server violates this standard, socat might not understand its answer.
  2282. This option directs socat to interprete NL as line terminator and
  2283. to ignore CR in the answer. Nevertheless, socat sends CR+NL to the proxy.
  2284. <a name="OPTION_PROXY_AUTHORIZATION"></a><p><dt><strong><strong><code>proxyauth=&lt;username&gt;:&lt;password&gt;</code></strong></strong><dd>
  2285. Provide "basic" authentication to the proxy server. The argument to the
  2286. option is used with a "Proxy-Authorization: Base" header in base64 encoded
  2287. form.<br>
  2288. Note: username and password are visible for every user on the local machine
  2289. in the process list; username and password are transferred to the proxy
  2290. server unencrypted (base64 encoded) and might be sniffed.
  2291. <a name="OPTION_PROXY_RESOLVE"></a><p><dt><strong><strong><code>resolve</code></strong></strong><dd>
  2292. Per default, socat sends to the proxy a CONNECT request containing the
  2293. target hostname. With this option, socat resolves the hostname locally and
  2294. sends the IP address. Please note that, according to RFC 2396, only name
  2295. resolution to IPv4 addresses is implemented.
  2296. </dl>
  2297. <p>
  2298. <dl></dl><br>
  2299. <p>
  2300. <a name="GROUP_RANGE"></a><em><strong>RANGE option group</strong></em>
  2301. <p>
  2302. These options check if a connecting client should be granted access. They can
  2303. be applied to listening and receiving network sockets. tcp-wrappers options
  2304. fall into this group.
  2305. <dl>
  2306. <a name="OPTION_RANGE"></a><p><dt><strong><strong><code>range=&lt;address-range&gt;</code></strong></strong><dd>
  2307. After accepting a connection, tests if the peer is within <em>range</em>. For
  2308. IPv4 addresses, address-range takes the form address/bits, e.g.
  2309. 10.0.0.0/8, or address:mask, e.g. 10.0.0.0:255.0.0.0 (<a href="socat.html#EXAMPLE_OPTION_RANGE">example</a>); for IPv6, it is [ip6-address]/bits, e.g. [::1]/128.
  2310. If the client address does not match, <strong>socat</strong> refuses the connection attempt, issues a warning, and keeps
  2311. listening/receiving.
  2312. <a name="OPTION_TCPWRAPPERS"></a><p><dt><strong><strong><code>tcpwrap[=&lt;name&gt;]</code></strong></strong><dd>
  2313. Uses Wietse Venema's libwrap (tcpd) library to determine
  2314. if the client is allowed to connect. The configuration files are
  2315. /etc/hosts.allow and /etc/hosts.deny per default, see "man 5 hosts_access"
  2316. for more information. The optional &lt;name&gt; (type <a href="socat.html#TYPE_STRING">string</a>)
  2317. is passed to the wrapper functions as daemon process name (<a href="socat.html#EXAMPLE_OPTION_TCPWRAPPERS">example</a>).
  2318. If omitted, the basename of socats invocation (argv[0]) is passed.
  2319. If both tcpwrap and range options are applied to an address, both
  2320. conditions must be fulfilled to allow the connection.
  2321. <a name="OPTION_TCPWRAP_HOSTS_ALLOW_TABLE"></a><p><dt><strong><strong><code>allow-table=&lt;filename&gt;</code></strong></strong><dd>
  2322. Takes the specified file instead of /etc/hosts.allow.
  2323. <a name="OPTION_TCPWRAP_HOSTS_DENY_TABLE"></a><p><dt><strong><strong><code>deny-table=&lt;filename&gt;</code></strong></strong><dd>
  2324. Takes the specified file instead of /etc/hosts.deny.
  2325. <a name="OPTION_TCPWRAP_ETC"></a><p><dt><strong><strong><code>tcpwrap-etc=&lt;directoryname&gt;</code></strong></strong><dd>
  2326. Looks for hosts.allow and hosts.deny in the specified directory. Is
  2327. overridden by options <a href="socat.html#OPTION_TCPWRAP_HOSTS_ALLOW_TABLE">hosts-allow</a>
  2328. and <a href="socat.html#OPTION_TCPWRAP_HOSTS_DENY_TABLE">hosts-deny</a>.
  2329. </dl>
  2330. <p>
  2331. <dl></dl><br>
  2332. <p>
  2333. <a name="GROUP_LISTEN"></a><em><strong>LISTEN option group</strong></em>
  2334. <p>
  2335. Options specific to listening sockets.
  2336. <dl>
  2337. <a name="OPTION_BACKLOG"></a><p><dt><strong><strong><code>backlog=&lt;count&gt;</code></strong></strong><dd>
  2338. Sets the backlog value passed with the
  2339. <code>listen()</code>
  2340. system call to &lt;count&gt;
  2341. [<a href="socat.html#TYPE_INT">int</a>]. Default is 5.
  2342. <a name="OPTION_MAX_CHILDREN"></a><p><dt><strong><strong><code>max-children=&lt;count&gt;</code></strong></strong><dd>
  2343. Limits the number of concurrent child processes [<a href="socat.html#TYPE_INT">int</a>].
  2344. Default is no limit.
  2345. </dl>
  2346. <dl></dl><br>
  2347. <p>
  2348. <a name="GROUP_CHILD"></a><em><strong>CHILD option group</strong></em>
  2349. <p>
  2350. Options for addresses with multiple connections via child processes.
  2351. <dl>
  2352. <a name="OPTION_FORK"></a><p><dt><strong><strong><code>fork</code></strong></strong><dd>
  2353. After establishing a connection, handles its channel in a child process and
  2354. keeps the parent process attempting to produce more connections, either by
  2355. listening or by connecting in a loop (<a href="socat.html#EXAMPLE_OPTION_FORK">example</a>).<br>
  2356. OPENSSL-CONNECT and OPENSSL-LISTEN differ in when they actually fork off the
  2357. child:
  2358. OPENSSL-LISTEN forks <em>before</em> the SSL handshake, while OPENSSL-CONNECT
  2359. forks <em>afterwards</em>.
  2360. RETRY and FOREVER options are not inherited by the child process.<br>
  2361. On some operating systems (e.g. FreeBSD) this option does not work for
  2362. UDP-LISTEN addresses.<br>
  2363. </dl>
  2364. <p>
  2365. <dl></dl><br>
  2366. <p>
  2367. <a name="GROUP_EXEC"></a><em><strong>EXEC option group</strong></em>
  2368. <p>
  2369. Options for addresses that invoke a program.
  2370. <dl>
  2371. <a name="OPTION_PATH"></a><p><dt><strong><strong><code>path=&lt;string&gt;</code></strong></strong><dd>
  2372. Overrides the PATH environment variable for searching the program with
  2373. <a href="socat.html#TYPE_STRING">&lt;string&gt;</a>. This
  2374. <code>$PATH</code>
  2375. value is effective in the child process too.
  2376. <a name="OPTION_LOGIN"></a><p><dt><strong><strong><code>login</code></strong></strong><dd>
  2377. Prefixes
  2378. <code>argv[0]</code>
  2379. for the
  2380. <code>execvp()</code>
  2381. call with '-', thus making a
  2382. shell behave as login shell.
  2383. </dl>
  2384. <p>
  2385. <dl></dl><br>
  2386. <p>
  2387. <a name="GROUP_FORK"></a><em><strong>FORK option group</strong></em>
  2388. <p>
  2389. EXEC or SYSTEM addresses invoke a program using a child process and transfer data between <strong>socat</strong> and the program. The interprocess communication mechanism can be influenced with the following options. Per
  2390. default, a
  2391. <code>socketpair()</code>
  2392. is created and assigned to stdin and stdout of
  2393. the child process, while stderr is inherited from the <strong>socat</strong> process, and the
  2394. child process uses file descriptors 0 and 1 for communicating with the main
  2395. socat process.
  2396. <dl>
  2397. <a name="OPTION_NOFORK"></a><p><dt><strong><strong><code>nofork</code></strong></strong><dd>
  2398. Does not fork a subprocess for executing the program, instead calls execvp()
  2399. or system() directly from the actual socat instance. This avoids the
  2400. overhead of another process between the program and its peer,
  2401. but introduces a lot of restrictions:
  2402. <ul>
  2403. <li> this option can only be applied to the second <strong>socat</strong> address.
  2404. <li> it cannot be applied to a part of a <a href="socat.html#ADDRESS_DUAL">dual</a> address.
  2405. <li> the first socat address cannot be OPENSSL or READLINE
  2406. <li> socat options -b, -t, -D, -l, -v, -x become useless
  2407. <li> for both addresses, options ignoreeof, cr, and crnl become useless
  2408. <li> for the second address (the one with option nofork), options
  2409. append, <!--async,--> cloexec, flock, user, group, mode, nonblock,
  2410. perm-late, setlk, and setpgid cannot be applied. Some of these could be
  2411. used on the first address though.
  2412. </ul>
  2413. <a name="OPTION_PIPES"></a><p><dt><strong><strong><code>pipes</code></strong></strong><dd>
  2414. Creates a pair of unnamed pipes for interprocess communication instead of a
  2415. socket pair.
  2416. <a name="OPTION_OPENPTY"></a><p><dt><strong><strong><code>openpty</code></strong></strong><dd>
  2417. Establishes communication with the sub process using a pseudo terminal
  2418. created with
  2419. <code>openpty()</code>
  2420. instead of the default (socketpair or ptmx).
  2421. <a name="OPTION_PTMX"></a><p><dt><strong><strong><code>ptmx</code></strong></strong><dd>
  2422. Establishes communication with the sub process using a pseudo terminal
  2423. created by opening <strong>/dev/ptmx</strong> or <strong>/dev/ptc</strong> instead of the default
  2424. (socketpair).
  2425. <a name="OPTION_PTY"></a><p><dt><strong><strong><code>pty</code></strong></strong><dd>
  2426. Establishes communication with the sub process using a pseudo terminal
  2427. instead of a socket pair. Creates the pty with an available mechanism. If
  2428. openpty and ptmx are both available, it uses ptmx because this is POSIX
  2429. compliant (<a href="socat.html#EXAMPLE_OPTION_PTY">example</a>).
  2430. <a name="OPTION_CTTY"></a><p><dt><strong><strong><code>ctty</code></strong></strong><dd>
  2431. Makes the pty the controlling tty of the sub process (<a href="socat.html#EXAMPLE_OPTION_CTTY">example</a>).
  2432. <a name="OPTION_STDERR"></a><p><dt><strong><strong><code>stderr</code></strong></strong><dd>
  2433. Directs stderr of the sub process to its output channel by making stderr a
  2434. <code>dup()</code>
  2435. of stdout (<a href="socat.html#EXAMPLE_OPTION_STDERR">example</a>).
  2436. <a name="OPTION_FDIN"></a><p><dt><strong><strong><code>fdin=&lt;fdnum&gt;</code></strong></strong><dd>
  2437. Assigns the sub processes input channel to its file descriptor
  2438. <a href="socat.html#TYPE_FDNUM">&lt;fdnum&gt;</a>
  2439. instead of stdin (0). The program started from the subprocess has to use
  2440. this fd for reading data from <strong>socat</strong> (<a href="socat.html#EXAMPLE_OPTION_FDIN">example</a>).
  2441. <a name="OPTION_FDOUT"></a><p><dt><strong><strong><code>fdout=&lt;fdnum&gt;</code></strong></strong><dd>
  2442. Assigns the sub processes output channel to its file descriptor
  2443. <a href="socat.html#TYPE_FDNUM">&lt;fdnum&gt;</a>
  2444. instead of stdout (1). The program started from the subprocess has to use
  2445. this fd for writing data to <strong>socat</strong> (<a href="socat.html#EXAMPLE_OPTION_FDOUT">example</a>).
  2446. <a name="OPTION_SIGHUP"></a><a name="OPTION_SIGINT"></a><a name="OPTION_SIGQUIT"></a><p><dt><strong><strong><code>sighup</code></strong>, <strong><code>sigint</code></strong>, <strong><code>sigquit</code></strong></strong><dd>
  2447. Has <strong>socat</strong> pass signals of this type to the sub process.
  2448. If no address has this option, socat terminates on these signals.
  2449. </dl>
  2450. <p>
  2451. <dl></dl><br>
  2452. <p>
  2453. <a name="GROUP_TERMIOS"></a><em><strong>TERMIOS option group</strong></em>
  2454. <p>
  2455. For addresses that work on a tty (e.g., stdio, file:/dev/tty, exec:...,pty), the terminal parameters defined in the UN*X termios mechanism are made available as address option parameters.
  2456. Please note that changes of the parameters of your interactive terminal
  2457. remain effective after <strong>socat</strong>'s termination, so you might have to enter "reset"
  2458. or "stty sane" in your shell afterwards.
  2459. For EXEC and SYSTEM addresses with option PTY,
  2460. these options apply to the pty by the child processes.
  2461. <p>
  2462. <dl>
  2463. <a name="OPTION_B0"></a><p><dt><strong><strong><code>b0</code></strong></strong><dd>
  2464. Disconnects the terminal.
  2465. <a name="OPTION_B19200"></a><p><dt><strong><strong><code>b19200</code></strong></strong><dd>
  2466. Sets the serial line speed to 19200 baud. Some other rates are possible; use
  2467. something like <code>socat -hh |grep ' b[1-9]'</code> to find all speeds supported by
  2468. your implementation.<br>
  2469. Note: On some operating systems, these options may not be
  2470. available. Use <a href="socat.html#OPTION_ISPEED">ispeed</a> or <a href="socat.html#OPTION_OSPEED">ospeed</a>
  2471. instead.
  2472. <a name="OPTION_ECHO"></a><p><dt><strong><strong><code>echo=&lt;bool&gt;</code></strong></strong><dd>
  2473. Enables or disables local echo.
  2474. <a name="OPTION_ICANON"></a><p><dt><strong><strong><code>icanon=&lt;bool&gt;</code></strong></strong><dd>
  2475. Sets or clears canonical mode, enabling line buffering and some special
  2476. characters.
  2477. <a name="OPTION_RAW"></a><p><dt><strong><strong><code>raw</code></strong></strong><dd>
  2478. Sets raw mode, thus passing input and output almost unprocessed. This option is obsolete, use option <a href="socat.html#OPTION_TERMIOS_RAWER">rawer</a> or <a href="socat.html#OPTION_TERMIOS_CFMAKERAW">cfmakeraw</a> instead.
  2479. <a name="OPTION_TERMIOS_RAWER"></a><p><dt><strong><strong><code>rawer</code></strong></strong><dd>
  2480. Makes terminal rawer than <a href="socat.html#OPTION_RAW">raw</a> option. This option implicitly turns off echo. (<a href="socat.html#EXAMPLE_OPTION_TERMIOS_RAWER">example</a>).
  2481. <a name="OPTION_TERMIOS_CFMAKERAW"></a><p><dt><strong><strong><code>cfmakeraw</code></strong></strong><dd>
  2482. Sets raw mode by invoking <code>cfmakeraw()</code> or by simulating this call. This option implicitly turns off echo.
  2483. <a name="OPTION_IGNBRK"></a><p><dt><strong><strong><code>ignbrk=&lt;bool&gt;</code></strong></strong><dd>
  2484. Ignores or interpretes the BREAK character (e.g., ^C)
  2485. <a name="OPTION_BRKINT"></a><p><dt><strong><strong><code>brkint=&lt;bool&gt;</code></strong></strong><dd>
  2486. <a name="OPTION_BS0"></a><p><dt><strong><strong><code>bs0</code></strong></strong><dd>
  2487. <a name="OPTION_BS1"></a><p><dt><strong><strong><code>bs1</code></strong></strong><dd>
  2488. <a name="OPTION_BSDLY"></a><p><dt><strong><strong><code>bsdly=&lt;0|1&gt;</code></strong></strong><dd>
  2489. <a name="OPTION_CLOCAL"></a><p><dt><strong><strong><code>clocal=&lt;bool&gt;</code></strong></strong><dd>
  2490. <p>
  2491. <a name="OPTION_CR0"></a><a name="OPTION_CR1"></a><a name="OPTION_CR2"></a><a name="OPTION_CR3"></a>
  2492. <dt><code><strong>cr0</strong><br>
  2493. <strong>cr1</strong><br>
  2494. <strong>cr2</strong><br>
  2495. <strong>cr3</strong></code><dd>
  2496. Sets the carriage return delay to 0, 1, 2, or 3, respectively.
  2497. 0 means no delay, the other values are terminal dependent.
  2498. <p>
  2499. <a name="OPTION_CRDLY"></a><p><dt><strong><strong><code>crdly=&lt;0|1|2|3&gt;</code></strong></strong><dd>
  2500. <a name="OPTION_CREAD"></a><p><dt><strong><strong><code>cread=&lt;bool&gt;</code></strong></strong><dd>
  2501. <a name="OPTION_CRTSCTS"></a><p><dt><strong><strong><code>crtscts=&lt;bool&gt;</code></strong></strong><dd>
  2502. <p>
  2503. <a name="OPTION_CS5"></a><a name="OPTION_CS6"></a><a name="OPTION_CS7"></a><a name="OPTION_CS8"></a>
  2504. <dt><code><strong>cs5</strong><br>
  2505. <strong>cs6</strong><br>
  2506. <strong>cs7</strong><br>
  2507. <strong>cs8</strong></code><dd>
  2508. Sets the character size to 5, 6, 7, or 8 bits, respectively.
  2509. <p>
  2510. <a name="OPTION_CSIZE"></a><p><dt><strong><strong><code>csize=&lt;0|1|2|3&gt;</code></strong></strong><dd>
  2511. <a name="OPTION_CSTOPB"></a><p><dt><strong><strong><code>cstopb=&lt;bool&gt;</code></strong></strong><dd>
  2512. Sets two stop bits, rather than one.
  2513. <a name="OPTION_VDSUSP"></a><p><dt><strong><strong><code>dsusp=&lt;byte&gt;</code></strong></strong><dd>
  2514. Sets the value for the VDSUSP character that suspends the current foreground
  2515. process and reactivates the shell (all except Linux).
  2516. <a name="OPTION_ECHOCTL"></a><p><dt><strong><strong><code>echoctl=&lt;bool&gt;</code></strong></strong><dd>
  2517. Echos control characters in hat notation (e.g. ^A)
  2518. <a name="OPTION_ECHOE"></a><p><dt><strong><strong><code>echoe=&lt;bool&gt;</code></strong></strong><dd>
  2519. <a name="OPTION_ECHOK"></a><p><dt><strong><strong><code>echok=&lt;bool&gt;</code></strong></strong><dd>
  2520. <a name="OPTION_ECHOKE"></a><p><dt><strong><strong><code>echoke=&lt;bool&gt;</code></strong></strong><dd>
  2521. <a name="OPTION_ECHONL"></a><p><dt><strong><strong><code>echonl=&lt;bool&gt;</code></strong></strong><dd>
  2522. <a name="OPTION_ECHOPRT"></a><p><dt><strong><strong><code>echoprt=&lt;bool&gt;</code></strong></strong><dd>
  2523. <a name="OPTION_EOF"></a><p><dt><strong><strong><code>eof=&lt;byte&gt;</code></strong></strong><dd>
  2524. <a name="OPTION_EOL"></a><p><dt><strong><strong><code>eol=&lt;byte&gt;</code></strong></strong><dd>
  2525. <a name="OPTION_EOL2"></a><p><dt><strong><strong><code>eol2=&lt;byte&gt;</code></strong></strong><dd>
  2526. <a name="OPTION_ERASE"></a><p><dt><strong><strong><code>erase=&lt;byte&gt;</code></strong></strong><dd>
  2527. <a name="OPTION_DISCARD"></a><p><dt><strong><strong><code>discard=&lt;byte&gt;</code></strong></strong><dd>
  2528. <a name="OPTION_FF0"></a><p><dt><strong><strong><code>ff0</code></strong></strong><dd>
  2529. <a name="OPTION_FF1"></a><p><dt><strong><strong><code>ff1</code></strong></strong><dd>
  2530. <a name="OPTION_FFDLY"></a><p><dt><strong><strong><code>ffdly=&lt;bool&gt;</code></strong></strong><dd>
  2531. <a name="OPTION_FLUSHO"></a><p><dt><strong><strong><code>flusho=&lt;bool&gt;</code></strong></strong><dd>
  2532. <a name="OPTION_HUPCL"></a><p><dt><strong><strong><code>hupcl=&lt;bool&gt;</code></strong></strong><dd>
  2533. <a name="OPTION_ICRNL"></a><p><dt><strong><strong><code>icrnl=&lt;bool&gt;</code></strong></strong><dd>
  2534. <a name="OPTION_IEXTEN"></a><p><dt><strong><strong><code>iexten=&lt;bool&gt;</code></strong></strong><dd>
  2535. <a name="OPTION_IGNCR"></a><p><dt><strong><strong><code>igncr=&lt;bool&gt;</code></strong></strong><dd>
  2536. <a name="OPTION_IGNPAR"></a><p><dt><strong><strong><code>ignpar=&lt;bool&gt;</code></strong></strong><dd>
  2537. <a name="OPTION_IMAXBEL"></a><p><dt><strong><strong><code>imaxbel=&lt;bool&gt;</code></strong></strong><dd>
  2538. <a name="OPTION_INLCR"></a><p><dt><strong><strong><code>inlcr=&lt;bool&gt;</code></strong></strong><dd>
  2539. <a name="OPTION_INPCK"></a><p><dt><strong><strong><code>inpck=&lt;bool&gt;</code></strong></strong><dd>
  2540. <a name="OPTION_INTR"></a><p><dt><strong><strong><code>intr=&lt;byte&gt;</code></strong></strong><dd>
  2541. <a name="OPTION_ISIG"></a><p><dt><strong><strong><code>isig=&lt;bool&gt;</code></strong></strong><dd>
  2542. <a name="OPTION_ISPEED"></a><p><dt><strong><strong><code>ispeed=&lt;unsigned-int&gt;</code></strong></strong><dd>
  2543. Set the baud rate for incoming data on this line.<br>
  2544. See also: <a href="socat.html#OPTION_OSPEED">ospeed</a>, <a href="socat.html#OPTION_B19200">b19200</a>
  2545. <a name="OPTION_ISTRIP"></a><p><dt><strong><strong><code>istrip=&lt;bool&gt;</code></strong></strong><dd>
  2546. <a name="OPTION_IUCLC"></a><p><dt><strong><strong><code>iuclc=&lt;bool&gt;</code></strong></strong><dd>
  2547. <a name="OPTION_IXANY"></a><p><dt><strong><strong><code>ixany=&lt;bool&gt;</code></strong></strong><dd>
  2548. <a name="OPTION_IXOFF"></a><p><dt><strong><strong><code>ixoff=&lt;bool&gt;</code></strong></strong><dd>
  2549. <a name="OPTION_IXON"></a><p><dt><strong><strong><code>ixon=&lt;bool&gt;</code></strong></strong><dd>
  2550. <a name="OPTION_KILL"></a><p><dt><strong><strong><code>kill=&lt;byte&gt;</code></strong></strong><dd>
  2551. <a name="OPTION_LNEXT"></a><p><dt><strong><strong><code>lnext=&lt;byte&gt;</code></strong></strong><dd>
  2552. <a name="OPTION_MIN"></a><p><dt><strong><strong><code>min=&lt;byte&gt;</code></strong></strong><dd>
  2553. <a name="OPTION_NL0"></a><p><dt><strong><strong><code>nl0</code></strong></strong><dd>
  2554. Sets the newline delay to 0.
  2555. <a name="OPTION_NL1"></a><p><dt><strong><strong><code>nl1</code></strong></strong><dd>
  2556. <a name="OPTION_NLDLY"></a><p><dt><strong><strong><code>nldly=&lt;bool&gt;</code></strong></strong><dd>
  2557. <a name="OPTION_NOFLSH"></a><p><dt><strong><strong><code>noflsh=&lt;bool&gt;</code></strong></strong><dd>
  2558. <a name="OPTION_OCRNL"></a><p><dt><strong><strong><code>ocrnl=&lt;bool&gt;</code></strong></strong><dd>
  2559. <a name="OPTION_OFDEL"></a><p><dt><strong><strong><code>ofdel=&lt;bool&gt;</code></strong></strong><dd>
  2560. <a name="OPTION_OFILL"></a><p><dt><strong><strong><code>ofill=&lt;bool&gt;</code></strong></strong><dd>
  2561. <a name="OPTION_OLCUC"></a><p><dt><strong><strong><code>olcuc=&lt;bool&gt;</code></strong></strong><dd>
  2562. <a name="OPTION_ONLCR"></a><p><dt><strong><strong><code>onlcr=&lt;bool&gt;</code></strong></strong><dd>
  2563. <a name="OPTION_ONLRET"></a><p><dt><strong><strong><code>onlret=&lt;bool&gt;</code></strong></strong><dd>
  2564. <a name="OPTION_ONOCR"></a><p><dt><strong><strong><code>onocr=&lt;bool&gt;</code></strong></strong><dd>
  2565. <a name="OPTION_OPOST"></a><p><dt><strong><strong><code>opost=&lt;bool&gt;</code></strong></strong><dd>
  2566. Enables or disables output processing; e.g., converts NL to CR-NL.
  2567. <a name="OPTION_OSPEED"></a><p><dt><strong><strong><code>ospeed=&lt;unsigned-int&gt;</code></strong></strong><dd>
  2568. Set the baud rate for outgoing data on this line.<br>
  2569. See also: <a href="socat.html#OPTION_ISPEED">ispeed</a>, <a href="socat.html#OPTION_B19200">b19200</a>
  2570. <a name="OPTION_PARENB"></a><p><dt><strong><strong><code>parenb=&lt;bool&gt;</code></strong></strong><dd>
  2571. Enable parity generation on output and parity checking for input.
  2572. <a name="OPTION_PARMRK"></a><p><dt><strong><strong><code>parmrk=&lt;bool&gt;</code></strong></strong><dd>
  2573. <a name="OPTION_PARODD"></a><p><dt><strong><strong><code>parodd=&lt;bool&gt;</code></strong></strong><dd>
  2574. <a name="OPTION_PENDIN"></a><p><dt><strong><strong><code>pendin=&lt;bool&gt;</code></strong></strong><dd>
  2575. <a name="OPTION_QUIT"></a><p><dt><strong><strong><code>quit=&lt;byte&gt;</code></strong></strong><dd>
  2576. <a name="OPTION_REPRINT"></a><p><dt><strong><strong><code>reprint=&lt;byte&gt;</code></strong></strong><dd>
  2577. <a name="OPTION_SANE"></a><p><dt><strong><strong><code>sane</code></strong></strong><dd>
  2578. Brings the terminal to something like a useful default state.
  2579. <a name="OPTION_START"></a><p><dt><strong><strong><code>start=&lt;byte&gt;</code></strong></strong><dd>
  2580. <a name="OPTION_STOP"></a><p><dt><strong><strong><code>stop=&lt;byte&gt;</code></strong></strong><dd>
  2581. <a name="OPTION_SUSP"></a><p><dt><strong><strong><code>susp=&lt;byte&gt;</code></strong></strong><dd>
  2582. <a name="OPTION_SWTC"></a><p><dt><strong><strong><code>swtc=&lt;byte&gt;</code></strong></strong><dd>
  2583. <a name="OPTION_TAB0"></a><p><dt><strong><strong><code>tab0</code></strong></strong><dd>
  2584. <a name="OPTION_TAB1"></a><p><dt><strong><strong><code>tab1</code></strong></strong><dd>
  2585. <a name="OPTION_TAB2"></a><p><dt><strong><strong><code>tab2</code></strong></strong><dd>
  2586. <a name="OPTION_TAB3"></a><p><dt><strong><strong><code>tab3</code></strong></strong><dd>
  2587. <a name="OPTION_TABDLY"></a><p><dt><strong><strong><code>tabdly=&lt;unsigned-int&gt;</code></strong></strong><dd>
  2588. <a name="OPTION_TIME"></a><p><dt><strong><strong><code>time=&lt;byte&gt;</code></strong></strong><dd>
  2589. <a name="OPTION_TOSTOP"></a><p><dt><strong><strong><code>tostop=&lt;bool&gt;</code></strong></strong><dd>
  2590. <a name="OPTION_VT0"></a><p><dt><strong><strong><code>vt0</code></strong></strong><dd>
  2591. <a name="OPTION_VT1"></a><p><dt><strong><strong><code>vt1</code></strong></strong><dd>
  2592. <a name="OPTION_VTDLY"></a><p><dt><strong><strong><code>vtdly=&lt;bool&gt;</code></strong></strong><dd>
  2593. <a name="OPTION_WERASE"></a><p><dt><strong><strong><code>werase=&lt;byte&gt;</code></strong></strong><dd>
  2594. <a name="OPTION_XCASE"></a><p><dt><strong><strong><code>xcase=&lt;bool&gt;</code></strong></strong><dd>
  2595. <a name="OPTION_XTABS"></a><p><dt><strong><strong><code>xtabs</code></strong></strong><dd>
  2596. <a name="OPTION_I_POP_ALL"></a><p><dt><strong><strong><code>i-pop-all</code></strong></strong><dd>
  2597. With UNIX System V STREAMS, removes all drivers from the stack.
  2598. <a name="OPTION_I_PUSH"></a><p><dt><strong><strong><code>i-push=&lt;string&gt;</code></strong></strong><dd>
  2599. With UNIX System V STREAMS, pushes the driver (module) with the given name
  2600. (<a href="socat.html#TYPE_STRING">string</a>) onto the stack. For example, to make sure that a
  2601. character device on Solaris supports termios etc, use the following options:
  2602. <code>i-pop-all,i-push=ptem,i-push=ldterm,i-push=ttcompat</code>
  2603. </dl>
  2604. <p>
  2605. <dl></dl><br>
  2606. <p>
  2607. <a name="GROUP_PTY"></a><em><strong>PTY option group</strong></em>
  2608. <p>
  2609. These options are intended for use with the <a href="socat.html#ADDRESS_PTY">pty</a> address
  2610. type.
  2611. <p>
  2612. <dl>
  2613. <a name="OPTION_SYMBOLIC_LINK"></a><p><dt><strong><strong><code>link=&lt;filename&gt;</code></strong></strong><dd>
  2614. Generates a symbolic link that points to the actual pseudo terminal
  2615. (pty). This might help
  2616. to solve the problem that ptys are generated with more or less
  2617. unpredictable names, making it difficult to directly access the socat
  2618. generated pty automatically. With this option, the user can specify a "fix"
  2619. point in the file hierarchy that helps him to access the actual pty
  2620. (<a href="socat.html#EXAMPLE_OPTION_SYMBOLIC_LINK">example</a>).
  2621. Beginning with <strong>socat</strong> version 1.4.3, the symbolic link is removed when
  2622. the address is closed (but see option <a href="socat.html#OPTION_UNLINK_CLOSE">unlink-close</a>).
  2623. <a name="OPTION_PTY_WAIT_SLAVE"></a><p><dt><strong><strong><code>wait-slave</code></strong></strong><dd>
  2624. Blocks the open phase until a process opens the slave side of the pty.
  2625. Usually, socat continues after generating the pty with opening the next
  2626. address or with entering the transfer loop. With the wait-slave option,
  2627. socat waits until some process opens the slave side of the pty before
  2628. continuing.
  2629. This option only works if the operating system provides the <code>poll()</code>
  2630. system call. And it depends on an undocumented behaviour of pty's, so it
  2631. does not work on all operating systems. It has successfully been tested on
  2632. Linux, FreeBSD, NetBSD, and on Tru64 with openpty.
  2633. <a name="OPTION_PTY_INTERVAL"></a><p><dt><strong><strong><code>pty-interval=&lt;seconds&gt;</code></strong></strong><dd>
  2634. When the <a href="socat.html#OPTION_PTY_WAIT_SLAVE">wait-slave</a> option is set, socat
  2635. periodically checks the HUP condition using <code>poll()</code> to find if the pty's
  2636. slave side has been opened. The default polling interval is 1s. Use the
  2637. pty-interval option [<a href="socat.html#TYPE_TIMEVAL">timeval</a>] to change this value.
  2638. </dl>
  2639. <p>
  2640. <dl></dl><br>
  2641. <p>
  2642. <a name="GROUP_OPENSSL"></a><em><strong>OPENSSL option group</strong></em>
  2643. <p>
  2644. These options apply to the <a href="socat.html#ADDRESS_OPENSSL_CONNECT">openssl</a> and
  2645. <a href="socat.html#ADDRESS_OPENSSL_LISTEN">openssl-listen</a> address types.
  2646. <p>
  2647. <dl>
  2648. <a name="OPTION_OPENSSL_CIPHERLIST"></a><p><dt><strong><strong><code>cipher=&lt;cipherlist&gt;</code></strong></strong><dd>
  2649. Selects the list of ciphers that may be used for the connection.
  2650. See the man page of
  2651. <code>ciphers</code>
  2652. , section <strong>CIPHER LIST FORMAT</strong>, for
  2653. detailed information about syntax, values, and default of &lt;cipherlist&gt;.<br>
  2654. Several cipher strings may be given, separated by ':'.
  2655. Some simple cipher strings:
  2656. <dl>
  2657. <p><dt><strong>3DES</strong><dd> Uses a cipher suite with triple DES.
  2658. <p><dt><strong>MD5</strong><dd> Uses a cipher suite with MD5.
  2659. <p><dt><strong>aNULL</strong><dd> Uses a cipher suite without authentication.
  2660. <p><dt><strong>NULL</strong><dd> Does not use encryption.
  2661. <p><dt><strong>HIGH</strong><dd> Uses a cipher suite with "high" encryption.
  2662. </dl>
  2663. Note that the peer must support the selected property, or the negotiation
  2664. will fail.
  2665. <a name="OPTION_OPENSSL_METHOD"></a><p><dt><strong><strong><code>method=&lt;ssl-method&gt;</code></strong></strong><dd>
  2666. This option is based on deprecated functions and is only available when
  2667. <strong>socat</strong> was build with option <code>--with-openssl-method</code>.
  2668. Sets the protocol version to be used. Valid strings (not case sensitive)
  2669. are:
  2670. <dl>
  2671. <p><dt><strong><code>SSL2</code></strong><dd> Select SSL protocol version 2.
  2672. <p><dt><strong><code>SSL3</code></strong><dd> Select SSL protocol version 3.
  2673. <p><dt><strong><code>SSL23</code></strong><dd> Select the best available SSL or TLS protocol.
  2674. <p><dt><strong><code>TLS1</code></strong><dd> Select TLS protocol version 1.
  2675. <p><dt><strong><code>TLS1.1</code></strong><dd> Select TLS protocol version 1.1.
  2676. <p><dt><strong><code>TLS1.2</code></strong><dd> Select TLS protocol version 1.2.
  2677. When this option is not provided OpenSSL negotiates the mothod with its
  2678. peer.
  2679. </dl>
  2680. <a name="OPTION_OPENSSL_VERIFY"></a><p><dt><strong><strong><code>verify=&lt;bool&gt;</code></strong></strong><dd>
  2681. Controls check of the peer's certificate. Default is 1 (true). Disabling
  2682. verify might open your socket for everyone, making the encryption useless!
  2683. <a name="OPTION_OPENSSL_CERTIFICATE"></a><p><dt><strong><strong><code>cert=&lt;filename&gt;</code></strong></strong><dd>
  2684. Specifies the file with the certificate and private key for authentication.
  2685. The certificate must be in OpenSSL format (*.pem).
  2686. With openssl-listen, use of this option is strongly
  2687. recommended. Except with cipher aNULL, "no shared ciphers" error will
  2688. occur when no certificate is given.
  2689. <a name="OPTION_OPENSSL_KEY"></a><p><dt><strong><strong><code>key=&lt;filename&gt;</code></strong></strong><dd>
  2690. Specifies the file with the private key. The private key may be in this
  2691. file or in the file given with the <a href="socat.html#OPTION_OPENSSL_CERTIFICATE">cert</a> option. The party that has
  2692. to proof that it is the owner of a certificate needs the private key.
  2693. <a name="OPTION_OPENSSL_DHPARAMS"></a><p><dt><strong><strong><code>dhparams=&lt;filename&gt;</code></strong></strong><dd>
  2694. Specifies the file with the Diffie Hellman parameters. These parameters may
  2695. also be in the file given with the <a href="socat.html#OPTION_OPENSSL_CERTIFICATE">cert</a>
  2696. option in which case the dhparams option is not needed.
  2697. <a name="OPTION_OPENSSL_CAFILE"></a><p><dt><strong><strong><code>cafile=&lt;filename&gt;</code></strong></strong><dd>
  2698. Specifies the file with the trusted (root) authority certificates. The file
  2699. must be in PEM format and should contain one or more certificates. The party
  2700. that checks the authentication of its peer trusts only certificates that are
  2701. in this file.
  2702. <a name="OPTION_OPENSSL_CAPATH"></a><p><dt><strong><strong><code>capath=&lt;dirname&gt;</code></strong></strong><dd>
  2703. Specifies the directory with the trusted (root) certificates. The directory
  2704. must contain certificates in PEM format and their hashes (see OpenSSL
  2705. documentation)
  2706. <a name="OPTION_OPENSSL_EGD"></a><p><dt><strong><strong><code>egd=&lt;filename&gt;</code></strong></strong><dd>
  2707. On some systems, openssl requires an explicit source of random data. Specify
  2708. the socket name where an entropy gathering daemon like egd provides random
  2709. data, e.g. /dev/egd-pool.
  2710. <a name="OPTION_OPENSSL_PSEUDO"></a><p><dt><strong><strong><code>pseudo</code></strong></strong><dd>
  2711. On systems where openssl cannot find an entropy source and where no entropy
  2712. gathering daemon can be utilized, this option activates a mechanism for
  2713. providing pseudo entropy. This is achieved by taking the current time in
  2714. microseconds for feeding the libc pseudo random number generator with an
  2715. initial value. openssl is then feeded with output from random() calls.<br>
  2716. NOTE:This mechanism is not sufficient for generation of secure keys!
  2717. <a name="OPTION_OPENSSL_COMPRESS"></a><p><dt><strong><strong><code>compress</code></strong></strong><dd>
  2718. Enable or disable the use of compression for a connection. Setting this to
  2719. "none" disables compression, setting it to "auto" lets OpenSSL choose the best
  2720. available algorithm supported by both parties. The default is to not touch any
  2721. compression-related settings.
  2722. NOTE: Requires OpenSSL 0.9.8 or higher and disabling compression with
  2723. OpenSSL 0.9.8 affects all new connections in the process.
  2724. <a name="OPTION_OPENSSL_COMMONNAME"></a><p><dt><strong><strong><code>commonname=&lt;string&gt;</code></strong></strong><dd>
  2725. Specify the commonname that the peer certificate must match. With
  2726. <a href="socat.html#ADDRESS_OPENSSL_CONNECT">OPENSSL-CONNECT</a> address this overrides the
  2727. given hostname or IP target address; with
  2728. <a href="socat.html#ADDRESS_OPENSSL_LISTEN">OPENSSL-LISTEN</a> this turns on check of peer
  2729. certificates commonname. This option has only meaning when option
  2730. <a href="socat.html#OPTION_OPENSSL_VERIFY">verify</a> is not disabled and the chosen cipher
  2731. provides a peer certificate.
  2732. <a name="OPTION_OPENSSL_FIPS"></a><p><dt><strong><strong><code>fips</code></strong></strong><dd>
  2733. Enables FIPS mode if compiled in. For info about the FIPS encryption
  2734. implementation standard see <a href="http://oss-institute.org/fips-faq.html">http://oss-institute.org/fips-faq.html</a>.
  2735. This mode might require that the involved certificates are generated with a
  2736. FIPS enabled version of openssl. Setting or clearing this option on one
  2737. socat address affects all OpenSSL addresses of this process.
  2738. </dl>
  2739. <p>
  2740. <dl></dl><br>
  2741. <p>
  2742. <a name="GROUP_RETRY"></a><em><strong>RETRY option group</strong></em>
  2743. <p>
  2744. Options that control retry of some system calls, especially connection
  2745. attempts.
  2746. <p>
  2747. <dl>
  2748. <a name="OPTION_RETRY"></a><p><dt><strong><strong><code>retry=&lt;num&gt;</code></strong></strong><dd>
  2749. Number of retries before the connection or listen attempt is aborted.
  2750. Default is 0, which means just one attempt.
  2751. <a name="OPTION_INTERVAL"></a><p><dt><strong><strong><code>interval=&lt;timespec&gt;</code></strong></strong><dd>
  2752. Time between consecutive attempts (seconds,
  2753. [<a href="socat.html#TYPE_TIMESPEC">timespec</a>]). Default is 1 second.
  2754. <a name="OPTION_FOREVER"></a><p><dt><strong><strong><code>forever</code></strong></strong><dd>
  2755. Performs an unlimited number of retry attempts.
  2756. </dl>
  2757. <p>
  2758. <dl></dl><br>
  2759. <p>
  2760. <a name="GROUP_TUN"></a><em><strong>TUN option group</strong></em>
  2761. <p>
  2762. Options that control Linux TUN/TAP interface device addresses.
  2763. <p>
  2764. <dl>
  2765. <a name="OPTION_TUN_DEVICE"></a><p><dt><strong><strong><code>tun-device=&lt;device-file&gt;</code></strong></strong><dd>
  2766. Instructs socat to take another path for the TUN clone device. Default is
  2767. <code>/dev/net/tun</code>.
  2768. <a name="OPTION_TUN_NAME"></a><p><dt><strong><strong><code>tun-name=&lt;if-name&gt;</code></strong></strong><dd>
  2769. Gives the resulting network interface a specific name instead of the system
  2770. generated (tun0, tun1, etc.)
  2771. <a name="OPTION_TUN_TYPE"></a><p><dt><strong><strong><code>tun-type=[tun|tap]</code></strong></strong><dd>
  2772. Sets the type of the TUN device; use this option to generate a TAP
  2773. device. See the Linux docu for the difference between these types.
  2774. When you try to establish a tunnel between two TUN devices, their types
  2775. should be the same.
  2776. <a name="OPTION_IFF_NO_PI"></a><p><dt><strong><strong><code>iff-no-pi</code></strong></strong><dd>
  2777. Sets the IFF_NO_PI flag which controls if the device includes additional
  2778. packet information in the tunnel.
  2779. When you try to establish a tunnel between two TUN devices, these flags
  2780. should have the same values.
  2781. <a name="OPTION_IFF_UP"></a><p><dt><strong><strong><code>iff-up</code></strong></strong><dd>
  2782. Sets the TUN network interface status UP. Strongly recommended.
  2783. <a name="OPTION_IFF_BROADCAST"></a><p><dt><strong><strong><code>iff-broadcast</code></strong></strong><dd>
  2784. Sets the BROADCAST flag of the TUN network interface.
  2785. <a name="OPTION_IFF_DEBUG"></a><p><dt><strong><strong><code>iff-debug</code></strong></strong><dd>
  2786. Sets the DEBUG flag of the TUN network interface.
  2787. <a name="OPTION_IFF_LOOPBACK"></a><p><dt><strong><strong><code>iff-loopback</code></strong></strong><dd>
  2788. Sets the LOOPBACK flag of the TUN network interface.
  2789. <a name="OPTION_IFF_POINTOPOINT"></a><p><dt><strong><strong><code>iff-pointopoint</code></strong></strong><dd>
  2790. Sets the POINTOPOINT flag of the TUN device.
  2791. <a name="OPTION_IFF_NOTRAILERS"></a><p><dt><strong><strong><code>iff-notrailers</code></strong></strong><dd>
  2792. Sets the NOTRAILERS flag of the TUN device.
  2793. <a name="OPTION_IFF_RUNNING"></a><p><dt><strong><strong><code>iff-running</code></strong></strong><dd>
  2794. Sets the RUNNING flag of the TUN device.
  2795. <a name="OPTION_IFF_NOARP"></a><p><dt><strong><strong><code>iff-noarp</code></strong></strong><dd>
  2796. Sets the NOARP flag of the TUN device.
  2797. <a name="OPTION_IFF_PROMISC"></a><p><dt><strong><strong><code>iff-promisc</code></strong></strong><dd>
  2798. Sets the PROMISC flag of the TUN device.
  2799. <a name="OPTION_IFF_ALLMULTI"></a><p><dt><strong><strong><code>iff-allmulti</code></strong></strong><dd>
  2800. Sets the ALLMULTI flag of the TUN device.
  2801. <a name="OPTION_IFF_MASTER"></a><p><dt><strong><strong><code>iff-master</code></strong></strong><dd>
  2802. Sets the MASTER flag of the TUN device.
  2803. <a name="OPTION_IFF_SLAVE"></a><p><dt><strong><strong><code>iff-slave</code></strong></strong><dd>
  2804. Sets the SLAVE flag of the TUN device.
  2805. <a name="OPTION_IFF_MULTICAST"></a><p><dt><strong><strong><code>iff-multicast</code></strong></strong><dd>
  2806. Sets the MULTICAST flag of the TUN device.
  2807. <a name="OPTION_IFFPORTSEL_"></a><p><dt><strong><strong><code>iff-portsel</code></strong></strong><dd>
  2808. Sets the PORTSEL flag of the TUN device.
  2809. <a name="OPTION_IFF_AUTOMEDIA"></a><p><dt><strong><strong><code>iff-automedia</code></strong></strong><dd>
  2810. Sets the AUTOMEDIA flag of the TUN device.
  2811. <a name="OPTION_IFF_DYNAMIC"></a><p><dt><strong><strong><code>iff-dynamic</code></strong></strong><dd>
  2812. Sets the DYNAMIC flag of the TUN device.
  2813. </dl>
  2814. <p>
  2815. <dl></dl><br>
  2816. <p>
  2817. <a name="VALUES"></a>
  2818. <h2>DATA VALUES</h2>
  2819. <p>
  2820. This section explains the different data types that address parameters and
  2821. address options can take.
  2822. <p>
  2823. <dl>
  2824. <a name="TYPE_ADDRESS_RANGE"></a><p><dt><strong>address-range</strong><dd>
  2825. Is currently only implemented for IPv4 and IPv6. See address-option
  2826. <a href="socat.html#OPTION_RANGE">`range'</a>
  2827. <a name="TYPE_BOOL"></a><p><dt><strong>bool</strong><dd>
  2828. "0" or "1"; if value is omitted, "1" is taken.
  2829. <a name="TYPE_BYTE"></a><p><dt><strong>byte</strong><dd>
  2830. An unsigned int number, read with
  2831. <code>strtoul()</code>
  2832. , lower or equal to
  2833. <code>UCHAR_MAX</code>
  2834. .
  2835. <a name="TYPE_COMMAND_LINE"></a><p><dt><strong>command-line</strong><dd>
  2836. A string specifying a program name and its arguments, separated by single
  2837. spaces.
  2838. <a name="TYPE_DATA"></a><p><dt><strong>data</strong><dd>
  2839. A raw data specification following <em>dalan</em> syntax. Currently the only
  2840. valid form is a string starting with 'x' followed by an even number of hex
  2841. digits, specifying a sequence of bytes.
  2842. <a name="TYPE_DIRECTORY"></a><p><dt><strong>directory</strong><dd>
  2843. A string with usual UN*X directory name semantics.
  2844. <a name="TYPE_FACILITY"></a><p><dt><strong>facility</strong><dd>
  2845. The name of a syslog facility in lower case characters.
  2846. <a name="TYPE_FDNUM"></a><p><dt><strong>fdnum</strong><dd>
  2847. An unsigned int type, read with
  2848. <code>strtoul()</code>
  2849. , specifying a UN*X file
  2850. descriptor.
  2851. <a name="TYPE_FILENAME"></a><p><dt><strong>filename</strong><dd>
  2852. A string with usual UN*X filename semantics.
  2853. <a name="TYPE_GROUP"></a><p><dt><strong>group</strong><dd>
  2854. If the first character is a decimal digit, the value is read with
  2855. <code>strtoul()</code>
  2856. as unsigned integer specifying a group id. Otherwise, it
  2857. must be an existing group name.
  2858. <a name="TYPE_INT"></a><p><dt><strong>int</strong><dd>
  2859. A number following the rules of the
  2860. <code>strtol()</code>
  2861. function with base
  2862. "0", i.e. decimal number, octal number with leading "0", or hexadecimal
  2863. number with leading "0x". The value must fit into a C int.
  2864. <a name="TYPE_INTERFACE"></a><p><dt><strong>interface</strong><dd>
  2865. A string specifying the device name of a network interface
  2866. as shown by ifconfig or procan, e.g. "eth0".
  2867. <a name="TYPE_IP_ADDRESS"></a><p><dt><strong>IP address</strong><dd>
  2868. An IPv4 address in numbers-and-dots notation, an IPv6 address in hex
  2869. notation enclosed in brackets, or a hostname that resolves to an IPv4 or an
  2870. IPv6 address.<br>
  2871. Examples: 127.0.0.1, [::1], www.dest-unreach.org, dns1
  2872. <a name="TYPE_IPV4_ADDRESS"></a><p><dt><strong>IPv4 address</strong><dd>
  2873. An IPv4 address in numbers-and-dots notation or a hostname that resolves to
  2874. an IPv4 address.<br>
  2875. Examples: 127.0.0.1, www.dest-unreach.org, dns2
  2876. <a name="TYPE_IPV6_ADDRESS"></a><p><dt><strong>IPv6 address</strong><dd>
  2877. An iPv6 address in hexnumbers-and-colons notation enclosed in brackets, or a
  2878. hostname that resolves to an IPv6 address.<br>
  2879. Examples: [::1], [1234:5678:9abc:def0:1234:5678:9abc:def0],
  2880. ip6name.domain.org
  2881. <a name="TYPE_LONG"></a><p><dt><strong>long</strong><dd>
  2882. A number read with
  2883. <code>strtol()</code>
  2884. . The value must fit into a C long.
  2885. <a name="TYPE_LONGLONG"></a><p><dt><strong>long long</strong><dd>
  2886. A number read with
  2887. <code>strtoll()</code>
  2888. . The value must fit into a C long long.
  2889. <a name="TYPE_OFF"></a><p><dt><strong>off_t</strong><dd>
  2890. An implementation dependend signed number, usually 32 bits, read with strtol
  2891. or strtoll.
  2892. <a name="TYPE_OFF64"></a><p><dt><strong>off64_t</strong><dd>
  2893. An implementation dependend signed number, usually 64 bits, read with strtol
  2894. or strtoll.
  2895. <a name="TYPE_MODE_T"></a><p><dt><strong>mode_t</strong><dd>
  2896. An unsigned integer, read with
  2897. <code>strtoul()</code>
  2898. , specifying mode (permission)
  2899. bits.
  2900. <a name="TYPE_PID_T"></a><p><dt><strong>pid_t</strong><dd>
  2901. A number, read with
  2902. <code>strtol()</code>
  2903. , specifying a process id.
  2904. <a name="TYPE_PORT"></a><p><dt><strong>port</strong><dd>
  2905. A uint16_t (16 bit unsigned number) specifying a TCP or UDP port, read
  2906. with
  2907. <code>strtoul()</code>
  2908. .
  2909. <a name="TYPE_PROTOCOL"></a><p><dt><strong>protocol</strong><dd>
  2910. An unsigned 8 bit number, read with
  2911. <code>strtoul()</code>
  2912. .
  2913. <a name="TYPE_SIZE_T"></a><p><dt><strong>size_t</strong><dd>
  2914. An unsigned number with size_t limitations, read with
  2915. <code>strtoul</code>
  2916. .
  2917. <a name="TYPE_SOCKNAME"></a><p><dt><strong>sockname</strong><dd>
  2918. A socket address. See address-option <a href="socat.html#OPTION_BIND">`bind'</a>
  2919. <a name="TYPE_STRING"></a><p><dt><strong>string</strong><dd>
  2920. A sequence of characters, not containing '\0' and, depending on
  2921. the position within the command line, ':', ',', or "!!". Note
  2922. that you might have to escape shell meta characters in the command line.
  2923. <a name="TYPE_TCP_SERVICE"></a><p><dt><strong>TCP service</strong><dd>
  2924. A service name, not starting with a digit, that is resolved by
  2925. <code>getservbyname()</code>
  2926. , or an unsigned int 16 bit number read with
  2927. <code>strtoul()</code>
  2928. .
  2929. <a name="TYPE_TIMEVAL"></a><p><dt><strong>timeval</strong><dd>
  2930. A double float specifying seconds; the number is mapped into a
  2931. struct timeval, consisting of seconds and microseconds.
  2932. <a name="TYPE_TIMESPEC"></a><p><dt><strong>timespec</strong><dd>
  2933. A double float specifying seconds; the number is mapped into a
  2934. struct timespec, consisting of seconds and nanoseconds.
  2935. <a name="TYPE_UDP_SERVICE"></a><p><dt><strong>UDP service</strong><dd>
  2936. A service name, not starting with a digit, that is resolved by
  2937. <code>getservbyname()</code>
  2938. , or an unsigned int 16 bit number read with
  2939. <code>strtoul()</code>
  2940. .
  2941. <a name="TYPE_UNSIGNED_INT"></a><p><dt><strong>unsigned int</strong><dd>
  2942. A number read with
  2943. <code>strtoul()</code>
  2944. . The value must fit into a C unsigned
  2945. int.
  2946. <a name="TYPE_USER"></a><p><dt><strong>user</strong><dd>
  2947. If the first character is a decimal digit, the value is read with
  2948. <code>strtoul()</code>
  2949. as unsigned integer specifying a user id. Otherwise, it must
  2950. be an existing user name.
  2951. </dl>
  2952. <p>
  2953. <a name="EXAMPLES"></a>
  2954. <h2>EXAMPLES</h2>
  2955. <p>
  2956. <dl>
  2957. <p>
  2958. <a name="EXAMPLE_ADDRESS_TCP4_CONNECT"></a>
  2959. <p><dt><strong><strong><code>socat - TCP4:www.domain.org:80</code></strong></strong><dd>
  2960. <p>
  2961. transfers data between <a href="socat.html#ADDRESS_STDIO">STDIO</a> (-) and a
  2962. <a href="socat.html#ADDRESS_TCP4_CONNECT">TCP4</a> connection to port 80 of host
  2963. www.domain.org. This example results in an interactive connection similar to
  2964. telnet or netcat. The stdin terminal parameters are not changed, so you may
  2965. close the relay with ^D or abort it with ^C.
  2966. <p>
  2967. <a name="EXAMPLE_ADDRESS_READLINE"></a>
  2968. <a name="EXAMPLE_OPTION_HISTORY"></a>
  2969. <dt><code><strong>socat -d -d READLINE,history=$HOME/.http_history \</strong><br>
  2970. <strong>TCP4:www.domain.org:www,crnl</strong></code><dd>
  2971. <p>
  2972. this is similar to the previous example, but you can edit the current line in a
  2973. bash like manner (<a href="socat.html#ADDRESS_READLINE">READLINE</a>) and use the
  2974. <a href="socat.html#OPTION_HISTORY">history</a> file .http_history; <strong>socat</strong> prints messages about
  2975. progress (<a href="socat.html#option_d_d">-d -d</a>). The port is specified by service name
  2976. (www), and correct network line termination characters
  2977. (<a href="socat.html#OPTION_CRNL">crnl</a>) instead of NL are used.
  2978. <p>
  2979. <a name="EXAMPLE_ADDRESS_TCP4_LISTEN"></a>
  2980. <p><dt><strong><strong><code>socat TCP4-LISTEN:www TCP4:www.domain.org:www</code></strong></strong><dd>
  2981. <p>
  2982. installs a simple TCP port forwarder. With
  2983. <a href="socat.html#ADDRESS_TCP4_LISTEN">TCP4-LISTEN</a> it listens on local port "www" until a
  2984. connection comes in, accepts it, then connects to the remote host
  2985. (<a href="socat.html#ADDRESS_TCP4_CONNECT">TCP4</a>) and starts data transfer. It will not accept
  2986. a second connection.
  2987. <p>
  2988. <a name="EXAMPLE_OPTION_BIND_TCP4"></a>
  2989. <a name="EXAMPLE_OPTION_REUSEADDR"></a>
  2990. <a name="EXAMPLE_OPTION_FORK"></a>
  2991. <a name="EXAMPLE_OPTION_SUBSTUSER"></a>
  2992. <a name="EXAMPLE_OPTION_RANGE"></a>
  2993. <dt><code><strong>socat -d -d -lmlocal2 \</strong><br>
  2994. <strong>TCP4-LISTEN:80,bind=myaddr1,su=nobody,fork,range=10.0.0.0/8,reuseaddr \</strong><br>
  2995. <strong>TCP4:www.domain.org:80,bind=myaddr2</strong></code><dd>
  2996. <p>
  2997. TCP port forwarder, each side bound to another local IP address
  2998. (<a href="socat.html#OPTION_BIND">bind</a>). This example handles an almost
  2999. arbitrary number of parallel or consecutive connections by
  3000. <a href="socat.html#OPTION_FORK">fork</a>'ing a new
  3001. process after each
  3002. <code>accept()</code>
  3003. . It provides a little security by
  3004. <a href="socat.html#OPTION_SUBSTUSER">su</a>'ing to user
  3005. nobody after forking; it only permits connections from the private 10 network
  3006. (<a href="socat.html#OPTION_RANGE">range</a>); due to <a href="socat.html#OPTION_REUSEADDR">reuseaddr</a>, it
  3007. allows immediate restart after master process's termination, even if some child
  3008. sockets are not completely shut down.
  3009. With <a href="socat.html#option_lm">-lmlocal2</a>, socat logs to stderr until successfully
  3010. reaching the accept loop. Further logging is directed to syslog with facility
  3011. local2.
  3012. <p>
  3013. <a name="EXAMPLE_ADDRESS_EXEC"></a>
  3014. <a name="EXAMPLE_OPTION_TCPWRAPPERS"></a>
  3015. <a name="EXAMPLE_OPTION_CHROOT"></a>
  3016. <a name="EXAMPLE_OPTION_SUBSTUSER_DELAYED"></a>
  3017. <a name="EXAMPLE_OPTION_PTY"></a>
  3018. <a name="EXAMPLE_OPTION_STDERR"></a>
  3019. <dt><code><strong>socat TCP4-LISTEN:5555,fork,tcpwrap=script \</strong><br>
  3020. <strong>EXEC:/bin/myscript,chroot=/home/sandbox,su-d=sandbox,pty,stderr</strong></code><dd>
  3021. <p>
  3022. a simple server that accepts connections
  3023. (<a href="socat.html#ADDRESS_TCP4_LISTEN">TCP4-LISTEN</a>) and <a href="socat.html#OPTION_FORK">fork</a>'s a new
  3024. child process for each connection; every child acts as single relay.
  3025. The client must match the rules for daemon process name "script" in
  3026. /etc/hosts.allow and /etc/hosts.deny, otherwise it is refused access (see "man
  3027. 5 hosts_access").
  3028. For <a href="socat.html#ADDRESS_EXEC">EXEC</a>'uting the program, the child process
  3029. <a href="socat.html#OPTION_CHROOT">chroot</a>'s
  3030. to <strong>/home/sandbox</strong>, <a href="socat.html#OPTION_SUBSTUSER">su</a>'s to user sandbox, and then starts
  3031. the program <strong>/home/sandbox/bin/myscript</strong>. <strong>Socat</strong> and
  3032. myscript communicate via a pseudo tty (<a href="socat.html#OPTION_PTY">pty</a>); myscript's
  3033. <a href="socat.html#OPTION_STDERR">stderr</a> is redirected to stdout,
  3034. so its error messages are transferred via <strong>socat</strong> to the connected client.
  3035. <p>
  3036. <a name="EXAMPLE_OPTION_FDIN"></a>
  3037. <a name="EXAMPLE_OPTION_FDOUT"></a>
  3038. <a name="EXAMPLE_OPTION_CRNL"></a>
  3039. <a name="EXAMPLE_OPTION_MSS"></a>
  3040. <dt><code><strong>socat EXEC:"mail.sh target@domain.com",fdin=3,fdout=4 \</strong><br>
  3041. <strong>TCP4:mail.relay.org:25,crnl,bind=alias1.server.org,mss=512</strong></code><dd>
  3042. <p>
  3043. <strong>mail.sh</strong> is a shell script, distributed with <strong>socat</strong>, that implements a
  3044. simple
  3045. SMTP client. It is programmed to "speak" SMTP on its FDs 3 (in) and 4 (out).
  3046. The <a href="socat.html#OPTION_FDIN">fdin</a> and <a href="socat.html#OPTION_FDOUT">fdout</a> options tell <strong>socat</strong>
  3047. to use these FDs for communication with
  3048. the program. Because mail.sh inherits stdin and stdout while <strong>socat</strong> does not
  3049. use them, the script can read a
  3050. mail body from stdin. <strong>Socat</strong> makes alias1 your local source address
  3051. (<a href="socat.html#OPTION_BIND">bind</a>), cares for correct network line termination
  3052. (<a href="socat.html#OPTION_CRNL">crnl</a>) and sends
  3053. at most 512 data bytes per packet (<a href="socat.html#OPTION_MSS">mss</a>).
  3054. <p>
  3055. <a name="EXAMPLE_ADDRESS_GOPEN"></a>
  3056. <a name="EXAMPLE_OPTION_TERMIOS_RAWER"></a>
  3057. <a name="EXAMPLE_OPTION_ESCAPE"></a>
  3058. <p><dt><strong><strong><code>socat -,escape=0x0f /dev/ttyS0,rawer,crnl</code></strong></strong><dd>
  3059. <p>
  3060. opens an interactive connection via the serial line, e.g. for talking with a
  3061. modem. <a href="socat.html#OPTION_TERMIOS_RAWER">rawer</a> sets the console's and
  3062. ttyS0's terminal parameters to practicable values, <a href="socat.html#OPTION_CRNL">crnl</a>
  3063. converts to correct newline characters. <a href="socat.html#OPTION_ESCAPE">escape</a> allows
  3064. terminating the socat process with character control-O.
  3065. Consider using <a href="socat.html#ADDRESS_READLINE">READLINE</a> instead of the first address.
  3066. <p>
  3067. <a name="EXAMPLE_ADDRESS_UNIX_LISTEN"></a>
  3068. <a name="EXAMPLE_ADDRESS_SOCKS4"></a>
  3069. <a name="EXAMPLE_OPTION_SOCKSUSER"></a>
  3070. <a name="EXAMPLE_OPTION_SOURCEPORT"></a>
  3071. <dt><code><strong>socat UNIX-LISTEN:/tmp/.X11-unix/X1,fork \</strong><br>
  3072. <strong>SOCKS4:host.victim.org:127.0.0.1:6000,socksuser=nobody,sourceport=20</strong></code><dd>
  3073. <p>
  3074. with <a href="socat.html#ADDRESS_UNIX_LISTEN">UNIX-LISTEN</a>, <strong>socat</strong> opens a listening
  3075. UNIX domain socket <strong>/tmp/.X11-unix/X1</strong>. This path corresponds
  3076. to local XWindow display :1 on your machine, so XWindow client connections to
  3077. DISPLAY=:1 are accepted. <strong>Socat</strong> then speaks with
  3078. the <a href="socat.html#ADDRESS_SOCKS4">SOCKS4</a> server host.victim.org that might permit
  3079. <a href="socat.html#OPTION_SOURCEPORT">sourceport</a> 20 based connections due to an FTP related
  3080. weakness in its static IP filters. <strong>Socat</strong>
  3081. pretends to be invoked by <a href="socat.html#OPTION_SOCKSUSER">socksuser</a> nobody, and
  3082. requests to be connected to
  3083. loopback port 6000 (only weak sockd configurations will allow this). So we get
  3084. a connection to the victims XWindow server and, if it does not require MIT
  3085. cookies or Kerberos authentication, we can start work. Please note that there
  3086. can only be one connection at a time, because TCP can establish only one
  3087. session with a given set of addresses and ports.
  3088. <p>
  3089. <a name="EXAMPLE_option_u"></a>
  3090. <a name="EXAMPLE_OPTION_IGNOREEOF"></a>
  3091. <p><dt><strong><strong><code>socat -u /tmp/readdata,seek-end=0,ignoreeof -</code></strong></strong><dd>
  3092. <p>
  3093. this is an example for unidirectional data transfer
  3094. (<a href="socat.html#option_u">-u</a>). <strong>Socat</strong> transfers data
  3095. from file /tmp/readdata (implicit address <a href="socat.html#ADDRESS_GOPEN">GOPEN</a>), starting
  3096. at its current end (<a href="socat.html#OPTION_SEEK_END">seek-end</a>=0 lets <strong>socat</strong> start
  3097. reading at current end of file; use <a href="socat.html#OPTION_SEEK">seek</a>=0 or no
  3098. seek option to first read the existing data) in a "tail -f" like mode
  3099. (<a href="socat.html#OPTION_IGNOREEOF">ignoreeof</a>). The "file"
  3100. might also be a listening UNIX domain socket (do not use a seek option then).
  3101. <p>
  3102. <a name="EXAMPLE_OPTION_SETSID"></a>
  3103. <a name="EXAMPLE_OPTION_CTTY"></a>
  3104. <dt><code><strong>(sleep 5; echo PASSWORD; sleep 5; echo ls; sleep 1) |</strong><br>
  3105. <strong>socat - EXEC:'ssh -l user server',pty,setsid,ctty</strong></code><dd>
  3106. <p>
  3107. <a href="socat.html#ADDRESS_EXEC">EXEC</a>'utes an ssh session to server. Uses a <a href="socat.html#OPTION_PTY">pty</a> for communication between <strong>socat</strong> and
  3108. ssh, makes it ssh's controlling tty (<a href="socat.html#OPTION_CTTY">ctty</a>),
  3109. and makes this pty the owner of
  3110. a new process group (<a href="socat.html#OPTION_SETSID">setsid</a>), so ssh accepts the password from <strong>socat</strong>.
  3111. <p>
  3112. <a name="EXAMPLE_ADDRESS_OPEN"></a>
  3113. <a name="EXAMPLE_OPTION_CREAT"></a>
  3114. <a name="EXAMPLE_OPTION_APPEND"></a>
  3115. <dt><code><strong>socat -u TCP4-LISTEN:3334,reuseaddr,fork \</strong><br>
  3116. <strong>OPEN:/tmp/in.log,creat,append</strong></code><dd>
  3117. <p>
  3118. implements a simple network based message collector.
  3119. For each client connecting to port 3334, a new child process is generated (option <a href="socat.html#OPTION_FORK">fork</a>).
  3120. All data sent by the clients are <a href="socat.html#OPTION_APPEND">append</a>'ed to the file /tmp/in.log.
  3121. If the file does not exist, socat <a href="socat.html#OPTION_O_CREAT">creat</a>'s it.
  3122. Option <a href="socat.html#OPTION_REUSEADDR">reuseaddr</a> allows immediate restart of the server
  3123. process.
  3124. <p>
  3125. <a name="EXAMPLE_OPTION_NOECHO"></a>
  3126. <p><dt><strong><strong><code>socat READLINE,noecho='[Pp]assword:' EXEC:'ftp ftp.server.com',pty,setsid,ctty</code></strong></strong><dd>
  3127. <p>
  3128. wraps a command line history (<a href="socat.html#ADDRESS_READLINE">READLINE</a>) around the <a href="socat.html#ADDRESS_EXEC">EXEC</a>'uted ftp client utility.
  3129. This allows editing and reuse of FTP commands for relatively comfortable
  3130. browsing through the ftp directory hierarchy. The password is echoed!
  3131. <a href="socat.html#OPTION_PTY">pty</a> is required to have ftp issue a prompt.
  3132. Nevertheless, there may occur some confusion with the password and FTP
  3133. prompts.
  3134. <p>
  3135. <a name="EXAMPLE_ADDRESS_PTY"></a>
  3136. <a name="EXAMPLE_OPTION_SYMBOLIC_LINK"></a>
  3137. <a name="EXAMPLE_OPTION_WAIT_SLAVE"></a>
  3138. <a name="EXAMPLE_OPTION_NONBLOCK"></a>
  3139. <dt><code><strong>socat PTY,link=$HOME/dev/vmodem0,rawer,wait-slave \</strong><br>
  3140. <strong>EXEC:'"ssh modemserver.us.org socat - /dev/ttyS0,nonblock,rawer"'</strong></code><dd>
  3141. <p>
  3142. generates a pseudo terminal
  3143. device (<a href="socat.html#ADDRESS_PTY">PTY</a>) on the client that can be reached under the
  3144. symbolic <a href="socat.html#OPTION_SYMBOLIC_LINK">link</a> <strong>$HOME/dev/vmodem0</strong>.
  3145. An application that expects a serial line or modem
  3146. can be configured to use <strong>$HOME/dev/vmodem0</strong>; its traffic will be directed
  3147. to a modemserver via ssh where another socat instance links it to
  3148. <strong>/dev/ttyS0</strong>.
  3149. <p>
  3150. <dt><code><strong>socat TCP4-LISTEN:2022,reuseaddr,fork \</strong><br>
  3151. <strong>PROXY:proxy:www.domain.org:22,proxyport=3128,proxyauth=user:pass</strong></code><dd>
  3152. <p>
  3153. starts a forwarder that accepts connections on port 2022, and directs them
  3154. through the <a href="socat.html#ADDRESS_PROXY_CONNECT">proxy</a> daemon listening on port 3128
  3155. (<a href="socat.html#OPTION_PROXYPORT">proxyport</a>) on host proxy, using the
  3156. CONNECT method, where they are authenticated as "user" with "pass" (<a href="socat.html#OPTION_PROXY_AUTHORIZATION">proxyauth</a>). The proxy
  3157. should establish connections to host www.domain.org on port 22 then.
  3158. <p>
  3159. <a name="EXAMPLE_ADDRESS_OPENSSL_CONNECT"></a>
  3160. <p><dt><strong><strong><code>socat - SSL:server:4443,cafile=server.crt,cert=client.pem</code></strong></strong><dd>
  3161. <p>
  3162. is an OpenSSL client that tries to establish a secure connection to an SSL
  3163. server. Option <a href="socat.html#OPTION_OPENSSL_CAFILE">cafile</a> specifies a file that
  3164. contains trust certificates: we trust the server only when it presents one of
  3165. these certificates and proofs that it owns the related private key.
  3166. Otherwise the connection is terminated.
  3167. With <a href="socat.html#OPTION_OPENSSL_CERTIFICATE">cert</a> a file containing the client certificate
  3168. and the associated private key is specified. This is required in case the
  3169. server wishes a client authentication; many Internet servers do not.<br>
  3170. The first address ('-') can be replaced by almost any other socat address.
  3171. <p>
  3172. <a name="EXAMPLE_ADDRESS_OPENSSL_LISTEN"></a>
  3173. <p><dt><strong><strong><code>socat OPENSSL-LISTEN:4443,reuseaddr,pf=ip4,fork,cert=server.pem,cafile=client.crt PIPE</code></strong></strong><dd>
  3174. <p>
  3175. is an OpenSSL server that accepts TCP connections, presents the certificate
  3176. from the file server.pem and forces the client to present a certificate that is
  3177. verified against cafile.crt.<br>
  3178. The second address ('PIPE') can be replaced by almost any other socat
  3179. address.<br>
  3180. For instructions on generating and distributing OpenSSL keys and certificates
  3181. see the additional socat docu <code>socat-openssl.txt</code>.
  3182. <p>
  3183. <p><dt><strong><strong><code>echo |socat -u - file:/tmp/bigfile,create,largefile,seek=100000000000</code></strong></strong><dd>
  3184. <p>
  3185. creates a 100GB sparse file; this requires a file system type that
  3186. supports this (ext2, ext3, reiserfs, jfs; not minix, vfat). The operation of
  3187. writing 1 byte might take long (reiserfs: some minutes; ext2: "no" time), and
  3188. the resulting file can consume some disk space with just its inodes (reiserfs:
  3189. 2MB; ext2: 16KB).
  3190. <p>
  3191. <p><dt><strong><strong><code>socat tcp-l:7777,reuseaddr,fork system:'filan -i 0 -s &gt;&amp;2',nofork</code></strong></strong><dd>
  3192. <p>
  3193. listens for incoming TCP connections on port 7777. For each accepted
  3194. connection, invokes a shell. This shell has its stdin and stdout directly
  3195. connected to the TCP socket (<a href="socat.html#OPTION_NOFORK">nofork</a>). The shell starts filan and lets it print the socket addresses to
  3196. stderr (your terminal window).
  3197. <p>
  3198. <p><dt><strong><strong><code>echo -e "\0\14\0\0\c" |socat -u - file:/usr/bin/squid.exe,seek=0x00074420</code></strong></strong><dd>
  3199. <p>
  3200. functions as primitive binary editor: it writes the 4 bytes 000 014 000 000 to
  3201. the executable /usr/bin/squid at offset 0x00074420 (this is a real world patch
  3202. to make the squid executable from Cygwin run under Windows, actual per May 2004).
  3203. <p>
  3204. <p><dt><strong><strong><code>socat - tcp:www.blackhat.org:31337,readbytes=1000</code></strong></strong><dd>
  3205. <p>
  3206. connects to an unknown service and prevents being flooded.
  3207. <p>
  3208. <a name="EXAMPLE_END_CLOSE"></a>
  3209. <p><dt><strong><strong><code>socat -U TCP:target:9999,end-close TCP-L:8888,reuseaddr,fork</code></strong></strong><dd>
  3210. <p>
  3211. merges data arriving from different TCP streams on port 8888 to just one stream
  3212. to target:9999. The <a href="socat.html#OPTION_END_CLOSE">end-close</a> option prevents the child
  3213. processes forked off by the second address from terminating the shared
  3214. connection to 9999 (close(2) just unlinks the inode which stays active as long
  3215. as the parent process lives; shutdown(2) would actively terminate the
  3216. connection).
  3217. <p>
  3218. <a name="EXAMPLE_ADDRESS_UDP4_BROADCAST_CLIENT"></a>
  3219. <p><dt><strong><strong><code>socat - UDP4-DATAGRAM:192.168.1.0:123,sp=123,broadcast,range=192.168.1.0/24</code></strong></strong><dd>
  3220. <p>
  3221. sends a broadcast to the network 192.168.1.0/24 and receives the replies of the
  3222. timeservers there. Ignores NTP packets from hosts outside this network.
  3223. <p>
  3224. <a name="EXAMPLE_ADDRESS_GENERIC_CLIENT"></a>
  3225. <p><dt><strong><strong><code>socat - SOCKET-DATAGRAM:2:2:17:x007bxc0a80100x0000000000000000,bind=x007bx00000000x0000000000000000,setsockopt-int=1:6:1,range=x0000xc0a80100x0000000000000000:x0000xffffff00x0000000000000000</code></strong></strong><dd>
  3226. <p>
  3227. is semantically equivalent to the <a href="socat.html#EXAMPLE_ADDRESS_UDP4_BROADCAST_CLIENT">previous
  3228. example</a>, but all parameters are
  3229. specified in generic form. the value 6 of setsockopt-int is the Linux value for
  3230. <code>SO_BROADCAST</code>.
  3231. <p>
  3232. <a name="EXAMPLE_ADDRESS_IP4_BROADCAST_CLIENT"></a>
  3233. <p><dt><strong><strong><code>socat - IP4-DATAGRAM:255.255.255.255:44,broadcast,range=10.0.0.0/8</code></strong></strong><dd>
  3234. <p>
  3235. sends a broadcast to the local network(s) using protocol 44. Accepts replies
  3236. from the private address range only.
  3237. <p>
  3238. <a name="EXAMPLE_ADDRESS_UDP4_MULTICAST"></a>
  3239. <p><dt><strong><strong><code>socat - UDP4-DATAGRAM:224.255.0.1:6666,bind=:6666,ip-add-membership=224.255.0.1:eth0</code></strong></strong><dd>
  3240. <p>
  3241. transfers data from stdin to the specified multicast address using UDP. Both
  3242. local and remote ports are 6666. Tells the interface eth0 to also accept
  3243. multicast packets of the given group. Multiple hosts on the local network can
  3244. run this command, so all data sent by any of the hosts will be received
  3245. by all the other ones. Note that there are many possible reasons for failure,
  3246. including IP-filters, routing issues, wrong interface selection by the
  3247. operating system, bridges, or a badly configured switch.
  3248. <p>
  3249. <a name="EXAMPLE_ADDRESS_TUN"></a>
  3250. <p><dt><strong><strong><code>socat TCP:host2:4443 TUN:192.168.255.1/24,up</code></strong></strong><dd>
  3251. <p>
  3252. establishes one side of a virtual (but not private!) network with host2 where a
  3253. similar process might run, with UDP-L and tun address 192.168.255.2. They can
  3254. reach each other using the addresses 192.168.255.1 and 192.168.255.2. Note that
  3255. streaming eg. via TCP or SSL does not guarantee to retain packet boundaries and
  3256. may thus cause packet loss.
  3257. <p>
  3258. <a name="EXAMPLE_INTERFACE"></a>
  3259. <p><dt><strong><strong><code>socat PTY,link=/var/run/ppp,rawer INTERFACE:hdlc0</code></strong></strong><dd>
  3260. <p>
  3261. circumvents the problem that pppd requires a serial device and thus might not
  3262. be able to work on a synchronous line that is represented by a network device.
  3263. socat creates a PTY to make pppd happy, binds to the network
  3264. <a href="socat.html#ADDRESS_INTERFACE">interface</a> <code>hdlc0</code>, and can transfer data between
  3265. both devices. Use pppd on device <code>/var/run/ppp</code> then.
  3266. <p>
  3267. <a name="EXAMPLE_HTTPECHO"></a>
  3268. <p><dt><strong><strong><code>socat -T 1 -d -d TCP-L:10081,reuseaddr,fork,crlf SYSTEM:"echo -e \"\\\"HTTP/1.0 200 OK\\\nDocumentType: text/plain\\\n\\\ndate: \$\(date\)\\\nserver:\$SOCAT_SOCKADDR:\$SOCAT_SOCKPORT\\\nclient: \$SOCAT_PEERADDR:\$SOCAT_PEERPORT\\\n\\\"\"; cat; echo -e \"\\\"\\\n\\\"\""</code></strong></strong><dd>
  3269. <p>
  3270. creates a simple HTTP echo server: each HTTP client that connects gets a valid
  3271. HTTP reply that contains information about the client address and port as it is
  3272. seen by the server host, the host address (which might vary on multihomed
  3273. servers), and the original client request.
  3274. <p>
  3275. <a name="EXAMPLE_ANCILLARY"></a>
  3276. <p><dt><strong><strong><code>socat -d -d UDP4-RECVFROM:9999,so-broadcast,so-timestamp,ip-pktinfo,ip-recverr,ip-recvopts,ip-recvtos,ip-recvttl!!- SYSTEM:'export; sleep 1' |grep SOCAT</code></strong></strong><dd>
  3277. <p>
  3278. waits for an incoming UDP packet on port 9999 and prints the environment
  3279. variables provided by socat. On BSD based systems you have to replace
  3280. <a href="socat.html#OPTION_IP_PKTINFO"><code>ip-pktinfo</code></a> with <a href="socat.html#OPTION_IP_RECVDSTADDR"><code>ip-recvdstaddr</code></a>,<a href="socat.html#OPTION_IP_RECVIF"><code>ip-recvif</code></a>. Especially interesting is
  3281. SOCAT_IP_DSTADDR: it contains the target address of the packet which may be a
  3282. unicast, multicast, or broadcast address.
  3283. <p>
  3284. <p><dt><strong><strong><code></code></strong></strong><dd>
  3285. <p>
  3286. </dl>
  3287. <p>
  3288. <a name="DIAGNOSTICS"></a>
  3289. <h2>DIAGNOSTICS</h2>
  3290. <p>
  3291. <strong>Socat</strong> uses a logging mechanism that allows filtering messages by severity. The
  3292. severities provided are more or less compatible to the appropriate syslog
  3293. priority. With one or up to four occurrences of the -d command line option, the
  3294. lowest priority of messages that are issued can be selected. Each message
  3295. contains a single uppercase character specifying the messages severity (one of
  3296. F, E, W, N, I, or D)
  3297. <p>
  3298. <dl>
  3299. <p><dt><strong>FATAL:</strong><dd> Conditions that require unconditional and immediate program termination.
  3300. <p><dt><strong>ERROR:</strong><dd> Conditions that prevent proper program processing. Usually the
  3301. program is terminated (see <a href="socat.html#option_s">option -s</a>).
  3302. <p><dt><strong>WARNING:</strong><dd> Something did not function correctly or is in a state where
  3303. correct further processing cannot be guaranteed, but might be possible.
  3304. <p><dt><strong>NOTICE:</strong><dd> Interesting actions of the program, e.g. for supervising <strong>socat</strong> in some kind of server mode.
  3305. <p><dt><strong>INFO:</strong><dd> Description of what the program does, and maybe why it
  3306. happens. Allows monitoring the lifecycles of file descriptors.
  3307. <p><dt><strong>DEBUG:</strong><dd> Description of how the program works, all system or library calls and their results.
  3308. </dl>
  3309. <p>
  3310. Log messages can be written to stderr, to a file, or to syslog.
  3311. <p>
  3312. On exit, <strong>socat</strong> gives status 0 if it terminated due to EOF or inactivity
  3313. timeout, with a positive value on error, and with a negative value on fatal
  3314. error.
  3315. <p>
  3316. <a name="FILES"></a>
  3317. <h2>FILES</h2>
  3318. <p>
  3319. /usr/bin/socat <br>
  3320. /usr/bin/filan <br>
  3321. /usr/bin/procan
  3322. <p>
  3323. <a name="ENVIRONMENT_VARIABLES"></a>
  3324. <h2>ENVIRONMENT VARIABLES</h2>
  3325. <p>
  3326. Input variables carry information from the environment to socat, output
  3327. variables are set by socat for use in executed scripts and programs.
  3328. <p>
  3329. In the output variables beginning with "SOCAT" this prefix is actually replaced
  3330. by the upper case name of the executable or the value of option
  3331. <a href="socat.html#option_lp">-lp</a>.
  3332. <p>
  3333. <dl>
  3334. <a name="ENV_SOCAT_DEFAULT_LISTEN_IP"></a>
  3335. <p><dt><strong><strong>SOCAT_DEFAULT_LISTEN_IP</strong> (input)</strong><dd> (Values 4 or 6) Sets the IP version to
  3336. be used for listen, recv, and recvfrom addresses if no
  3337. <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a> (protocol-family) option is given. Is
  3338. overridden by socat options <a href="socat.html#option_4">-4</a> or <a href="socat.html#option_6">-6</a>.
  3339. <p>
  3340. <p><dt><strong><strong>SOCAT_PREFERRED_RESOLVE_IP</strong> (input)</strong><dd> (Values 0, 4, or 6) Sets the IP
  3341. version to
  3342. be used when resolving target host names when version is not specified by
  3343. address type, option <a href="socat.html#OPTION_PROTOCOL_FAMILY">pf</a> (protocol-family), or
  3344. address format. If name resolution does not return a matching entry, the first
  3345. result (with differing IP version) is taken. With value 0, socat always selects
  3346. the first record and its IP version.
  3347. <p>
  3348. <p><dt><strong><strong>SOCAT_FORK_WAIT</strong> (input)</strong><dd> Specifies the time (seconds) to sleep the
  3349. parent and child processes after successful fork(). Useful for debugging.
  3350. <p>
  3351. <p><dt><strong><strong>SOCAT_VERSION</strong> (output)</strong><dd> Socat sets this variable to its version string,
  3352. e.g. <code>"1.7.0.0"</code> for released versions or e.g. <code>"1.6.0.1+envvar"</code> for
  3353. temporary versions; can be used in scripts invoked by socat.
  3354. <p>
  3355. <p><dt><strong><strong>SOCAT_PID</strong> (output)</strong><dd> Socat sets this variable to its process id. In case
  3356. of <a href="socat.html#OPTION_FORK">fork</a> address option, SOCAT_PID gets the child processes
  3357. id. Forking for <a href="socat.html#ADDRESS_EXEC">exec</a> and <a href="socat.html#ADDRESS_SYSTEM">system</a> does
  3358. not change SOCAT_PID.
  3359. <p>
  3360. <p><dt><strong><strong>SOCAT_PPID</strong> (output)</strong><dd> Socat sets this variable to its process id. In
  3361. case of <a href="socat.html#OPTION_FORK">fork</a>, SOCAT_PPID keeps the pid of the master process.
  3362. <p>
  3363. <p><dt><strong><strong>SOCAT_PEERADDR</strong> (output)</strong><dd> With passive socket addresses (all LISTEN and
  3364. RECVFROM addresses), this variable is set to a string describing the peers
  3365. socket address. Port information is not included.
  3366. <p>
  3367. <p><dt><strong><strong>SOCAT_PEERPORT</strong> (output)</strong><dd> With appropriate passive socket addresses
  3368. (TCP, UDP, and SCTP - LISTEN and RECVFROM), this variable is set to a string containing the
  3369. number of the peer port.
  3370. <p>
  3371. <p><dt><strong><strong>SOCAT_SOCKADDR</strong> (output)</strong><dd> With all LISTEN addresses, this variable is
  3372. set to a string describing the local socket address. Port information is not
  3373. included <a href="socat.html#EXAMPLE_HTTPECHO">example</a>
  3374. <p>
  3375. <p><dt><strong><strong>SOCAT_SOCKPORT</strong> (output)</strong><dd> With <a href="socat.html#ADDRESS_TCP_LISTEN">TCP-LISTEN</a>,
  3376. <a href="socat.html#ADDRESS_UDP_LISTEN">UDP-LISTEN</a>, and
  3377. <a href="socat.html#ADDRESS_SCTP_LISTEN">SCTP-LISTEN</a> addresses, this variable is set to the
  3378. local port.
  3379. <p>
  3380. <p><dt><strong><strong>SOCAT_TIMESTAMP</strong> (output)</strong><dd> With all RECVFROM addresses where address
  3381. option <a href="socat.html#OPTION_SO_TIMESTAMP">so-timestamp</a> is applied, socat sets this
  3382. variable to the resulting timestamp.
  3383. <p>
  3384. <p><dt><strong><strong>SOCAT_IP_OPTIONS</strong> (output)</strong><dd> With all IPv4 based RECVFROM addresses where
  3385. address option <a href="socat.html#OPTION_IP_RECVOPTS">ip-recvopts</a> is applied, socat fills
  3386. this variable with the IP options of the received packet.
  3387. <p>
  3388. <p><dt><strong><strong>SOCAT_IP_DSTADDR</strong> (output)</strong><dd> With all IPv4 based RECVFROM addresses where
  3389. address option <a href="socat.html#OPTION_IP_RECVDSTADDR">ip-recvdstaddr</a> (BSD) or
  3390. <a href="socat.html#OPTION_IP_PKTINFO">ip-pktinfo</a> (other platforms) is applied, socat sets
  3391. this variable to the destination address of the received packet. This is
  3392. particularly useful to identify broadcast and multicast addressed packets.
  3393. <p>
  3394. <p><dt><strong><strong>SOCAT_IP_IF</strong> (output)</strong><dd> With all IPv4 based RECVFROM addresses where
  3395. address option <a href="socat.html#OPTION_IP_RECVIF">ip-recvif</a> (BSD) or
  3396. <a href="socat.html#OPTION_IP_PKTINFO">ip-pktinfo</a> (other platforms) is applied, socat sets
  3397. this variable to the name of the interface where the packet was received.
  3398. <p>
  3399. <p><dt><strong><strong>SOCAT_IP_LOCADDR</strong> (output)</strong><dd> With all IPv4 based RECVFROM
  3400. addresses where address option <a href="socat.html#OPTION_IP_PKTINFO">ip-pktinfo</a> is applied,
  3401. socat sets this variable to the address of the interface where the packet was
  3402. received.
  3403. <p>
  3404. <p><dt><strong><strong>SOCAT_IP_TOS</strong> (output)</strong><dd> With all IPv4 based RECVFROM addresses where
  3405. address option <a href="socat.html#OPTION_IP_RECVTOS">ip-recvtos</a> is applied, socat sets this
  3406. variable to the TOS (type of service) of the received packet.
  3407. <p>
  3408. <p><dt><strong><strong>SOCAT_IP_TTL</strong> (output)</strong><dd> With all IPv4 based RECVFROM addresses where
  3409. address option <a href="socat.html#OPTION_IP_RECVTTL">ip-recvttl</a> is applied, socat sets this
  3410. variable to the TTL (time to live) of the received packet.
  3411. <p>
  3412. <p><dt><strong><strong>SOCAT_IPV6_HOPLIMIT</strong> (output)</strong><dd> With all IPv6 based RECVFROM addresses
  3413. where address option <a href="socat.html#OPTION_IPV6_RECVHOPLIMIT">ipv6-recvhoplimit</a> is
  3414. applied, socat sets this variable to the hoplimit value of the received packet.
  3415. <p>
  3416. <p><dt><strong><strong>SOCAT_IPV6_DSTADDR</strong> (output)</strong><dd> With all IPv6 based RECVFROM
  3417. addresses where address option <a href="socat.html#OPTION_IPV6_RECVPKTINFO">ipv6-recvpktinfo</a>
  3418. is applied, socat sets this variable to the destination address of the received
  3419. packet.
  3420. <p>
  3421. <p><dt><strong><strong>SOCAT_IPV6_TCLASS</strong> (output)</strong><dd> With all IPv6 based RECVFROM addresses
  3422. where address option <a href="socat.html#OPTION_IPV6_RECVTCLASS">ipv6-recvtclass</a> is applied,
  3423. <strong>socat</strong> sets this variable to the transfer class of the received packet.
  3424. <p>
  3425. <p><dt><strong><strong>SOCAT_OPENSSL_X509_ISSUER</strong> (output)</strong><dd> Issuer field from peer certificate
  3426. <p>
  3427. <p><dt><strong><strong>SOCAT_OPENSSL_X509_SUBJECT</strong> (output)</strong><dd> Subject field from peer certificate
  3428. <p>
  3429. <p><dt><strong><strong>SOCAT_OPENSSL_X509_COMMONNAME</strong> (output)</strong><dd> commonName entries from peer certificates subject. Multiple values are separated by " // ".
  3430. <p>
  3431. <p><dt><strong><strong>SOCAT_OPENSSL_X509_*</strong> (output)</strong><dd> all other entries from peer certificates subject
  3432. <p>
  3433. <p><dt><strong><strong>SOCAT_OPENSSL_X509V3_DNS</strong> (output)</strong><dd> DNS entries from peer certificates extensions - subjectAltName field. Multiple values are separated by " // ".
  3434. <p>
  3435. <p><dt><strong><strong>HOSTNAME</strong> (input)</strong><dd> Is used to determine the hostname for logging (see
  3436. <a href="socat.html#option_lh">-lh</a>).
  3437. <p>
  3438. <p><dt><strong><strong>LOGNAME</strong> (input)</strong><dd> Is used as name for the socks client user name if no
  3439. <a href="socat.html#OPTION_SOCKSUSER">socksuser</a> is given.<br>
  3440. With options <a href="socat.html#OPTION_SUBSTUSER">su</a> and
  3441. <a href="socat.html#OPTION_SUBSTUSER_DELAYED">su-d</a>, LOGNAME is set to the given user name.
  3442. <p>
  3443. <p><dt><strong><strong>USER</strong> (input)</strong><dd> Is used as name for the socks client user name if no
  3444. <a href="socat.html#OPTION_SOCKSUSER">socksuser</a> is given and LOGNAME is empty.<br>
  3445. With options <a href="socat.html#OPTION_SUBSTUSER">su</a> and
  3446. <a href="socat.html#OPTION_SUBSTUSER_DELAYED">su-d</a>, USER is set to the given user name.
  3447. <p>
  3448. <p><dt><strong><strong>SHELL</strong> (output)</strong><dd>
  3449. With options <a href="socat.html#OPTION_SUBSTUSER">su</a> and
  3450. <a href="socat.html#OPTION_SUBSTUSER_DELAYED">su-d</a>, SHELL is set to the login shell of the
  3451. given user.
  3452. <p>
  3453. <p><dt><strong><strong>PATH</strong> (output)</strong><dd>
  3454. Can be set with option <a href="socat.html#OPTION_PATH">path</a> for <a href="socat.html#ADDRESS_EXEC">exec</a> and
  3455. <a href="socat.html#ADDRESS_SYSTEM">system</a> addresses.
  3456. <p>
  3457. <p><dt><strong><strong>HOME</strong> (output)</strong><dd>
  3458. With options <a href="socat.html#OPTION_SUBSTUSER">su</a> and
  3459. <a href="socat.html#OPTION_SUBSTUSER_DELAYED">su-d</a>, HOME is set to the home directory of the
  3460. given user.
  3461. <p>
  3462. </dl>
  3463. <p>
  3464. <a name="CREDITS"></a>
  3465. <h2>CREDITS</h2>
  3466. <p>
  3467. The work of the following groups and organizations was invaluable for this
  3468. project:
  3469. <p>
  3470. The <em>FSF</em> (GNU, <a href="http://www.fsf.org/">http://www.fsf.org/</a> project
  3471. with their free and portable development software and
  3472. lots of other useful tools and libraries.
  3473. <p>
  3474. The <em>Linux developers community</em> (<a href="http://www.linux.org/">http://www.linux.org/</a>) for providing a free, open source operating
  3475. system.
  3476. <p>
  3477. The <em>Open Group</em> (<a href="http://www.unix-systems.org/">http://www.unix-systems.org/</a>) for making their
  3478. standard specifications available on the Internet for free.
  3479. <p>
  3480. <a name="VERSION"></a>
  3481. <h2>VERSION</h2>
  3482. <p>
  3483. This man page describes version 1.7.3 of <strong>socat</strong>.
  3484. <p>
  3485. <a name="BUGS"></a>
  3486. <h2>BUGS</h2>
  3487. <p>
  3488. Addresses cannot be nested, so a single socat process cannot, e.g., drive ssl
  3489. over socks.
  3490. <p>
  3491. Address option ftruncate without value uses default 1 instead of 0.
  3492. <p>
  3493. Verbose modes (-x and/or -v) display line termination characters inconsistently
  3494. when address options cr or crnl are used: They show the data <em>after</em>
  3495. conversion in either direction.
  3496. <p>
  3497. The data transfer blocksize setting (-b) is ignored with address readline.
  3498. <p>
  3499. Send bug reports to &lt;socat@dest-unreach.org&gt;
  3500. <p>
  3501. <a name="SEEALSO"></a>
  3502. <h2>SEE ALSO</h2>
  3503. <p>
  3504. nc(1), rinetd(8), openssl(1),
  3505. stunnel(8), rlwrap(1), setsid(1)
  3506. <p>
  3507. <strong>Socat</strong> home page <a href="http://www.dest-unreach.org/socat/">http://www.dest-unreach.org/socat/</a>
  3508. <p>
  3509. <a name="AUTHOR"></a>
  3510. <h2>AUTHOR</h2>
  3511. <p>
  3512. Gerhard Rieger &lt;rieger@dest-unreach.org&gt; and contributors