PageRenderTime 70ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 1ms

/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

Large files files are truncated, but you can click here to view the full file

  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

Large files files are truncated, but you can click here to view the full file