PageRenderTime 73ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/doc/socat.yo

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