PageRenderTime 58ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/doc/socat.1

https://github.com/xscc/socat
Unknown | 3701 lines | 3603 code | 98 blank | 0 comment | 0 complexity | a6a25a53ff0478c3b71c8e48f00ec892 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. .TH "socat" "1" "Mar 2014" "" ""
  2. .PP
  3. .SH "NAME"
  4. socat \- Multipurpose relay (SOcket CAT)
  5. .PP
  6. .SH "SYNOPSIS"
  7. \f(CWsocat [options] <address> <address>\fP
  8. .br
  9. \f(CWsocat \-V\fP
  10. .br
  11. \f(CWsocat \-h[h[h]] | \-?[?[?]]\fP
  12. .br
  13. \f(CWfilan\fP
  14. .br
  15. \f(CWprocan\fP
  16. .PP
  17. .SH "DESCRIPTION"
  18. .PP
  19. \fBSocat\fP is a command line based utility that establishes two bidirectional byte
  20. streams and transfers data between them\&. Because the streams can be constructed
  21. from a large set of different types of data sinks and sources
  22. (see address types), and because lots of
  23. address options may be applied to the streams, socat can
  24. be used for many different purposes\&.
  25. .PP
  26. \fBFilan\fP is a utility that prints information about its active file
  27. descriptors to stdout\&. It has been written for debugging \fBsocat\fP, but might be
  28. useful for other purposes too\&. Use the \-h option to find more infos\&.
  29. .PP
  30. \fBProcan\fP is a utility that prints information about process parameters to
  31. stdout\&. It has been written to better understand
  32. some UNIX process properties and for debugging \fBsocat\fP, but might be
  33. useful for other purposes too\&.
  34. .PP
  35. The life cycle of a \fBsocat\fP instance typically consists of four phases\&.
  36. .PP
  37. In the \fIinit\fP phase, the command line options are parsed and logging is
  38. initialized\&.
  39. .PP
  40. During the \fIopen\fP phase, \fBsocat\fP opens the first address and afterwards the
  41. second address\&. These steps are usually blocking; thus, especially for complex address types like socks,
  42. connection requests or authentication dialogs must be completed before the next
  43. step is started\&.
  44. .PP
  45. In the \fItransfer\fP phase, \fBsocat\fP watches both streams\(cq\& read and write file
  46. descriptors via
  47. \f(CWselect()\fP
  48. , and, when data is available on one side \fIand\fP
  49. can be written to the other side, socat reads it, performs newline
  50. character conversions if required, and writes the data to the write file
  51. descriptor of the other stream, then continues waiting for more data in both
  52. directions\&.
  53. .PP
  54. When one of the streams effectively reaches EOF, the \fIclosing\fP phase
  55. begins\&. \fBSocat\fP transfers the EOF condition to the other stream,
  56. i\&.e\&. tries to shutdown only its write stream, giving it a chance to
  57. terminate gracefully\&. For a defined time \fBsocat\fP continues to transfer data in
  58. the other direction, but then closes all remaining channels and terminates\&.
  59. .PP
  60. .SH "OPTIONS"
  61. .PP
  62. \fBSocat\fP provides some command line options that modify the behaviour of the
  63. program\&. They have nothing to do with so called
  64. address options that are used as parts of address specifications\&.
  65. .PP
  66. .IP "\fB\f(CW\-V\fP\fP"
  67. Print version and available feature information to stdout, and exit\&.
  68. .IP "\fB\f(CW\-h | \-?\fP\fP"
  69. Print a help text to stdout describing command line options and available address
  70. types, and exit\&.
  71. .IP "\fB\f(CW\-hh | \-??\fP\fP"
  72. Like \-h, plus a list of the short names of all available address options\&. Some options are
  73. platform dependend, so this output is helpful for checking the particular
  74. implementation\&.
  75. .IP "\fB\f(CW\-hhh | \-???\fP\fP"
  76. Like \-hh, plus a list of all available address option names\&.
  77. .IP "\fB\f(CW\-d\fP\fP"
  78. Without this option, only fatal and error messages are generated; applying
  79. this option also prints warning messages\&. See DIAGNOSTICS
  80. for more information\&.
  81. .IP "\fB\f(CW\-d \-d\fP\fP"
  82. Prints fatal, error, warning, and notice messages\&.
  83. .IP "\fB\f(CW\-d \-d \-d\fP\fP"
  84. Prints fatal, error, warning, notice, and info messages\&.
  85. .IP "\fB\f(CW\-d \-d \-d \-d\fP\fP"
  86. Prints fatal, error, warning, notice, info, and debug
  87. messages\&.
  88. .IP "\fB\f(CW\-D\fP\fP"
  89. Logs information about file descriptors before starting the transfer phase\&.
  90. .IP "\fB\f(CW\-ly[<facility>]\fP\fP"
  91. Writes messages to syslog instead of stderr; severity as defined with \-d
  92. option\&. With optional <facility>, the syslog type can
  93. be selected, default is \(dq\&daemon\(dq\&\&. Third party libraries might not obey this
  94. option\&.
  95. .IP "\fB\f(CW\-lf\fP\fP\f(CW <logfile>\fP"
  96. Writes messages to <logfile> [filename] instead of
  97. stderr\&. Some third party libraries, in particular libwrap, might not obey
  98. this option\&.
  99. .IP "\fB\f(CW\-ls\fP\fP"
  100. Writes messages to stderr (this is the default)\&. Some third party libraries
  101. might not obey this option, in particular libwrap appears to only log to
  102. syslog\&.
  103. .IP "\fB\f(CW\-lp\fP\fP\f(CW<progname>\fP"
  104. Overrides the program name printed in error messages and used for
  105. constructing environment variable names\&.
  106. .IP "\fB\f(CW\-lu\fP\fP"
  107. Extends the timestamp of error messages to microsecond resolution\&. Does not
  108. work when logging to syslog\&.
  109. .IP "\fB\f(CW\-lm[<facility>]\fP\fP"
  110. Mixed log mode\&. During startup messages are printed to stderr; when \fBsocat\fP
  111. starts the transfer phase loop or daemon mode (i\&.e\&. after opening all
  112. streams and before starting data transfer, or, with listening sockets with
  113. fork option, before the first accept call), it switches logging to syslog\&.
  114. With optional <facility>, the syslog type can be
  115. selected, default is \(dq\&daemon\(dq\&\&.
  116. .IP "\fB\f(CW\-lh\fP\fP"
  117. Adds hostname to log messages\&. Uses the value from environment variable
  118. HOSTNAME or the value retrieved with \f(CWuname()\fP if HOSTNAME is not set\&.
  119. .IP "\fB\f(CW\-v\fP\fP"
  120. Writes the transferred data not only to their target streams, but also to
  121. stderr\&. The output format is text with some conversions for readability, and
  122. prefixed with \(dq\&> \(dq\& or \(dq\&< \(dq\& indicating flow directions\&.
  123. .IP "\fB\f(CW\-x\fP\fP"
  124. Writes the transferred data not only to their target streams, but also to
  125. stderr\&. The output format is hexadecimal, prefixed with \(dq\&> \(dq\& or \(dq\&< \(dq\&
  126. indicating flow directions\&. Can be combined with
  127. \f(CW\-v\fP
  128. \&.
  129. .IP "\fB\f(CW\-b\fP\fP\f(CW<size>\fP"
  130. Sets the data transfer block <size> [size_t]\&.
  131. At most <size> bytes are transferred per step\&. Default is 8192 bytes\&.
  132. .IP "\fB\f(CW\-s\fP\fP"
  133. By default, \fBsocat\fP terminates when an error occurred to prevent the process
  134. from running when some option could not be applied\&. With this
  135. option, \fBsocat\fP is sloppy with errors and tries to continue\&. Even with this
  136. option, socat will exit on fatals, and will abort connection attempts when
  137. security checks failed\&.
  138. .IP "\fB\f(CW\-t\fP\fP\f(CW<timeout>\fP"
  139. When one channel has reached EOF, the write part of the other channel is shut
  140. down\&. Then, \fBsocat\fP waits <timeout> [timeval] seconds
  141. before terminating\&. Default is 0\&.5 seconds\&. This timeout only applies to
  142. addresses where write and read part can be closed independently\&. When during
  143. the timeout interval the read part gives EOF, socat terminates without
  144. awaiting the timeout\&.
  145. .IP "\fB\f(CW\-T\fP\fP\f(CW<timeout>\fP"
  146. Total inactivity timeout: when socat is already in the transfer loop and
  147. nothing has happened for <timeout> [timeval] seconds
  148. (no data arrived, no interrupt occurred\&.\&.\&.) then it terminates\&.
  149. Useful with protocols like UDP that cannot transfer EOF\&.
  150. .IP "\fB\f(CW\-u\fP\fP"
  151. Uses unidirectional mode\&. The first address is only used for reading, and the
  152. second address is only used for writing (example)\&.
  153. .IP "\fB\f(CW\-U\fP\fP"
  154. Uses unidirectional mode in reverse direction\&. The first address is only
  155. used for writing, and the second address is only used for reading\&.
  156. .IP "\fB\f(CW\-g\fP\fP"
  157. During address option parsing, don\(cq\&t check if the option is considered
  158. useful in the given address environment\&. Use it if you want to force, e\&.g\&.,
  159. appliance of a socket option to a serial device\&.
  160. .IP "\fB\f(CW\-L\fP\fP\f(CW<lockfile>\fP"
  161. If lockfile exists, exits with error\&. If lockfile does not exist, creates it
  162. and continues, unlinks lockfile on exit\&.
  163. .IP "\fB\f(CW\-W\fP\fP\f(CW<lockfile>\fP"
  164. If lockfile exists, waits until it disappears\&. When lockfile does not exist,
  165. creates it and continues, unlinks lockfile on exit\&.
  166. .IP "\fB\f(CW\-4\fP\fP"
  167. Use IP version 4 in case that the addresses do not implicitly or explicitly
  168. specify a version; this is the default\&.
  169. .IP "\fB\f(CW\-6\fP\fP"
  170. Use IP version 6 in case that the addresses do not implicitly or explicitly
  171. specify a version\&.
  172. .PP
  173. .SH "ADDRESS SPECIFICATIONS"
  174. .PP
  175. With the address command line arguments, the user gives \fBsocat\fP instructions and
  176. the necessary information for establishing the byte streams\&.
  177. .PP
  178. An address specification usually consists of an address type
  179. keyword, zero or more required address parameters separated by \(cq\&:\(cq\& from the keyword and
  180. from each
  181. other, and zero or more address options separated by \(cq\&,\(cq\&\&.
  182. .PP
  183. The keyword specifies the address type (e\&.g\&., TCP4, OPEN, EXEC)\&. For some
  184. keywords there exist synonyms (\(cq\&\-\(cq\& for STDIO, TCP for TCP4)\&. Keywords are case
  185. insensitive\&.
  186. For a few special address types, the keyword may be omitted:
  187. Address specifications starting with a number are assumed to be FD (raw file
  188. descriptor) addresses;
  189. if a \(cq\&/\(cq\& is found before the first \(cq\&:\(cq\& or \(cq\&,\(cq\&, GOPEN (generic file open) is
  190. assumed\&.
  191. .PP
  192. The required number and type of address parameters depend on the address
  193. type\&. E\&.g\&., TCP4 requires a server specification (name or address), and a port
  194. specification (number or service name)\&.
  195. .PP
  196. Zero or more address options may be given with each address\&. They influence the
  197. address in some ways\&.
  198. Options consist of an option keyword or an option keyword and a value,
  199. separated by \(cq\&=\(cq\&\&. Option keywords are case insensitive\&.
  200. For filtering the options that are useful with an address
  201. type, each option is member of one option group\&. For
  202. each address type there is a set of option groups allowed\&. Only options
  203. belonging to one of these address groups may be used (except with option \-g)\&.
  204. .PP
  205. Address specifications following the above schema are also called \fIsingle\fP
  206. address specifications\&.
  207. Two single addresses can be combined with \(dq\&!!\(dq\& to form a \fIdual\fP type
  208. address for one channel\&. Here, the first address is used by \fBsocat\fP for reading
  209. data, and the
  210. second address for writing data\&. There is no way to specify an option only once
  211. for being applied to both single addresses\&.
  212. .PP
  213. Usually, addresses are opened in read/write
  214. mode\&. When an address is part of a dual address specification, or when
  215. option \-u or \-U is used, an address might be
  216. used only for reading or for writing\&. Considering this is important with some
  217. address types\&.
  218. .PP
  219. With socat version 1\&.5\&.0 and higher, the lexical analysis tries to handle
  220. quotes and parenthesis meaningfully and allows escaping of special characters\&.
  221. If one of the characters ( { [ \(cq\& is found, the corresponding closing
  222. character \- ) } ] \(cq\& \- is looked for; they may also be nested\&. Within these
  223. constructs, socats special characters and strings : , !! are not handled
  224. specially\&. All those characters and strings can be escaped with \e or within \(dq\&\(dq\&
  225. .PP
  226. .SH "ADDRESS TYPES"
  227. .PP
  228. This section describes the available address types with their keywords,
  229. parameters, and semantics\&.
  230. .PP
  231. .IP "\fB\f(CWCREATE:<filename>\fP\fP"
  232. Opens <filename> with
  233. \f(CWcreat()\fP
  234. and uses the file
  235. descriptor for writing\&.
  236. This address type requires write\-only context, because a file opened with
  237. \f(CWcreat\fP
  238. cannot be read from\&.
  239. .br
  240. Flags like O_LARGEFILE cannot be applied\&. If you need them use
  241. OPEN with options
  242. create,create\&.
  243. .br
  244. <filename> must be a valid existing or not existing path\&.
  245. If <filename> is a named pipe,
  246. \f(CWcreat()\fP
  247. might block;
  248. if <filename> refers to a socket, this is an error\&.
  249. .br
  250. Option groups: FD,REG,NAMED
  251. .br
  252. Useful options:
  253. mode,
  254. user,
  255. group,
  256. unlink\-early,
  257. unlink\-late,
  258. append
  259. .br
  260. See also: OPEN, GOPEN
  261. .IP "\fB\f(CWEXEC:<command\-line>\fP\fP"
  262. Forks a sub process that establishes communication with its parent process
  263. and invokes the specified program with
  264. \f(CWexecvp()\fP
  265. \&.
  266. <command\-line> is a simple command
  267. with arguments separated by single spaces\&. If the program name
  268. contains a \(cq\&/\(cq\&, the part after the last \(cq\&/\(cq\& is taken as ARGV[0]\&. If the
  269. program name is a relative
  270. path, the
  271. \f(CWexecvp()\fP
  272. semantics for finding the program via
  273. \f(CW$PATH\fP
  274. apply\&. After successful program start, \fBsocat\fP writes data to stdin of the
  275. process and reads from its stdout using a UNIX domain socket generated by
  276. \f(CWsocketpair()\fP
  277. per default\&. (example)
  278. .br
  279. Option groups: FD,SOCKET,EXEC,FORK,TERMIOS
  280. .br
  281. Useful options:
  282. path,
  283. fdin,
  284. fdout,
  285. chroot,
  286. su,
  287. su\-d,
  288. nofork,
  289. pty,
  290. stderr,
  291. ctty,
  292. setsid,
  293. pipes,
  294. login,
  295. sigint,
  296. sigquit
  297. .br
  298. See also: SYSTEM
  299. .IP "\fB\f(CWFD:<fdnum>\fP\fP"
  300. Uses the file descriptor <fdnum>\&. It must already exist as
  301. valid UN*X file descriptor\&.
  302. .br
  303. Option groups: FD (TERMIOS,REG,SOCKET)
  304. .br
  305. See also:
  306. STDIO,
  307. STDIN,
  308. STDOUT,
  309. STDERR
  310. .IP "\fB\f(CWGOPEN:<filename>\fP\fP"
  311. (Generic open) This address type tries to handle any file system entry
  312. except directories usefully\&. <filename> may be a
  313. relative or absolute path\&. If it already exists, its type is checked\&.
  314. In case of a UNIX domain socket, \fBsocat\fP connects; if connecting fails,
  315. \fBsocat\fP assumes a datagram socket and uses
  316. \f(CWsendto()\fP
  317. calls\&.
  318. If the entry is not a socket, \fBsocat\fP opens it applying the
  319. \f(CWO_APPEND\fP
  320. flag\&.
  321. If it does not exist, it is opened with flag
  322. \f(CWO_CREAT\fP
  323. as a regular file (example)\&.
  324. .br
  325. Option groups: FD,REG,SOCKET,NAMED,OPEN
  326. .br
  327. See also:
  328. OPEN,
  329. CREATE,
  330. UNIX\-CONNECT
  331. .IP
  332. .IP "\fB\f(CWIP\-SENDTO:<host>:<protocol>\fP\fP"
  333. Opens a raw IP socket\&. Depending on host specification or option pf, IP protocol version
  334. 4 or 6 is used\&. It uses <protocol> to send packets
  335. to <host> [IP address] and receives packets from
  336. host, ignores packets from other hosts\&.
  337. Protocol 255 uses the raw socket with the IP header being part of the
  338. data\&.
  339. .br
  340. Option groups: FD,SOCKET,IP4,IP6
  341. .br
  342. Useful options:
  343. pf,
  344. ttl
  345. .br
  346. See also:
  347. IP4\-SENDTO,
  348. IP6\-SENDTO,
  349. IP\-RECVFROM,
  350. IP\-RECV,
  351. UDP\-SENDTO,
  352. UNIX\-SENDTO
  353. .IP "\fB\f(CWINTERFACE:<interface>\fP\fP"
  354. Communicates with a network connected on an interface using raw packets
  355. including link level data\&. <interface> is the name of
  356. the network interface\&. Currently only available on Linux\&.
  357. Option groups: FD,SOCKET
  358. .br
  359. Useful options:
  360. pf,
  361. type
  362. .br
  363. See also: ip\-recv
  364. .IP "\fB\f(CWIP4\-SENDTO:<host>:<protocol>\fP\fP"
  365. Like IP\-SENDTO, but always uses IPv4\&.
  366. .br
  367. Option groups: FD,SOCKET,IP4
  368. .br
  369. .IP "\fB\f(CWIP6\-SENDTO:<host>:<protocol>\fP\fP"
  370. Like IP\-SENDTO, but always uses IPv6\&.
  371. .br
  372. Option groups: FD,SOCKET,IP6
  373. .br
  374. .IP
  375. .IP "\fB\f(CWIP\-DATAGRAM:<address>:<protocol>\fP\fP"
  376. Sends outgoing data to the specified address which may in particular be a
  377. broadcast or multicast address\&. Packets arriving on the local socket are
  378. checked if their source addresses match
  379. RANGE or TCPWRAP
  380. options\&. This address type can for example be used for implementing
  381. symmetric or asymmetric broadcast or multicast communications\&.
  382. .br
  383. Option groups: FD, SOCKET,
  384. IP4, IP6, RANGE
  385. .br
  386. Useful options:
  387. bind,
  388. range,
  389. tcpwrap,
  390. broadcast,
  391. ip\-multicast\-loop,
  392. ip\-multicast\-ttl,
  393. ip\-multicast\-if,
  394. ip\-add\-membership,
  395. ttl,
  396. tos,
  397. pf
  398. .br
  399. See also:
  400. IP4\-DATAGRAM,
  401. IP6\-DATAGRAM,
  402. IP\-SENDTO,
  403. IP\-RECVFROM,
  404. IP\-RECV,
  405. UDP\-DATAGRAM
  406. .IP "\fB\f(CWIP4\-DATAGRAM:<host>:<protocol>\fP\fP"
  407. Like IP\-DATAGRAM, but always uses IPv4\&.
  408. (example)
  409. .br
  410. Option groups: FD,SOCKET,IP4,RANGE
  411. .br
  412. .IP "\fB\f(CWIP6\-DATAGRAM:<host>:<protocol>\fP\fP"
  413. Like IP\-DATAGRAM, but always uses IPv6\&. Please
  414. note that IPv6 does not know broadcasts\&.
  415. .br
  416. Option groups: FD,SOCKET,IP6,RANGE
  417. .br
  418. .IP
  419. .IP "\fB\f(CWIP\-RECVFROM:<protocol>\fP\fP"
  420. Opens a raw IP socket of <protocol>\&. Depending on option pf, IP protocol version
  421. 4 or 6 is used\&. It receives one packet from an unspecified peer and may send one or more answer packets to that peer\&.
  422. This mode is particularly useful with fork option where each arriving packet \- from arbitrary peers \- is handled by its own sub process\&.
  423. This allows a behaviour similar to typical UDP based servers like ntpd or
  424. named\&.
  425. .br
  426. Please note that the reply packets might be fetched as incoming traffic when
  427. sender and receiver IP address are identical because there is no port number
  428. to distinguish the sockets\&.
  429. .br
  430. This address works well with IP\-SENDTO address peers (see above)\&.
  431. Protocol 255 uses the raw socket with the IP header being part of the
  432. data\&.
  433. .br
  434. Option groups: FD,SOCKET,IP4,IP6,CHILD,RANGE
  435. .br
  436. Useful options:
  437. pf,
  438. fork,
  439. range,
  440. ttl,
  441. broadcast
  442. .br
  443. See also:
  444. IP4\-RECVFROM,
  445. IP6\-RECVFROM,
  446. IP\-SENDTO,
  447. IP\-RECV,
  448. UDP\-RECVFROM,
  449. UNIX\-RECVFROM
  450. .IP "\fB\f(CWIP4\-RECVFROM:<protocol>\fP\fP"
  451. Like IP\-RECVFROM, but always uses IPv4\&.
  452. .br
  453. Option groups: FD,SOCKET,IP4,CHILD,RANGE
  454. .br
  455. .IP "\fB\f(CWIP6\-RECVFROM:<protocol>\fP\fP"
  456. Like IP\-RECVFROM, but always uses IPv6\&.
  457. .br
  458. Option groups: FD,SOCKET,IP6,CHILD,RANGE
  459. .br
  460. .IP
  461. .IP "\fB\f(CWIP\-RECV:<protocol>\fP\fP"
  462. Opens a raw IP socket of <protocol>\&. Depending on option pf, IP protocol version
  463. 4 or 6 is used\&. It receives packets from multiple unspecified peers and merges the data\&.
  464. No replies are possible\&.
  465. It can be, e\&.g\&., addressed by socat IP\-SENDTO address peers\&.
  466. Protocol 255 uses the raw socket with the IP header being part of the
  467. data\&.
  468. .br
  469. Option groups: FD,SOCKET,IP4,IP6,RANGE
  470. .br
  471. Useful options:
  472. pf,
  473. range
  474. .br
  475. See also:
  476. IP4\-RECV,
  477. IP6\-RECV,
  478. IP\-SENDTO,
  479. IP\-RECVFROM,
  480. UDP\-RECV,
  481. UNIX\-RECV
  482. .IP "\fB\f(CWIP4\-RECV:<protocol>\fP\fP"
  483. Like IP\-RECV, but always uses IPv4\&.
  484. .br
  485. Option groups: FD,SOCKET,IP4,RANGE
  486. .br
  487. .IP "\fB\f(CWIP6\-RECV:<protocol>\fP\fP"
  488. Like IP\-RECV, but always uses IPv6\&.
  489. .br
  490. Option groups: FD,SOCKET,IP6,RANGE
  491. .br
  492. .IP
  493. .IP "\fB\f(CWOPEN:<filename>\fP\fP"
  494. Opens <filename> using the
  495. \f(CWopen()\fP
  496. system call
  497. (example)\&.
  498. This operation fails on UNIX domain sockets\&.
  499. .br
  500. Note: This address type is rarly useful in bidirectional mode\&.
  501. .br
  502. Option groups: FD,REG,NAMED,OPEN
  503. .br
  504. Useful options:
  505. creat,
  506. excl,
  507. noatime,
  508. nofollow,
  509. append,
  510. rdonly,
  511. wronly,
  512. lock,
  513. readbytes,
  514. ignoreeof
  515. .br
  516. See also:
  517. CREATE,
  518. GOPEN,
  519. UNIX\-CONNECT
  520. .IP "\fB\f(CWOPENSSL:<host>:<port>\fP\fP"
  521. Tries to establish a SSL connection to <port> [TCP
  522. service] on
  523. <host> [IP address] using TCP/IP version 4 or 6
  524. depending on address specification, name resolution, or option
  525. pf\&.
  526. .br
  527. NOTE: The server certificate is only checked for validity against
  528. cafile or capath,
  529. but not for match with the server\(cq\&s name or its IP address!
  530. .br
  531. Option groups: FD,SOCKET,IP4,IP6,TCP,OPENSSL,RETRY
  532. .br
  533. Useful options:
  534. cipher,
  535. method,
  536. verify,
  537. cafile,
  538. capath,
  539. certificate,
  540. key,
  541. compress,
  542. bind,
  543. pf,
  544. connect\-timeout,
  545. sourceport,
  546. retry
  547. .br
  548. See also:
  549. OPENSSL\-LISTEN,
  550. TCP
  551. .IP "\fB\f(CWOPENSSL\-LISTEN:<port>\fP\fP"
  552. Listens on tcp <port> [TCP service]\&.
  553. The IP version is 4 or the one specified with
  554. pf\&. When a
  555. connection is accepted, this address behaves as SSL server\&.
  556. .br
  557. Note: You probably want to use the certificate option with this address\&.
  558. .br
  559. NOTE: The client certificate is only checked for validity against
  560. cafile or capath,
  561. but not for match with the client\(cq\&s name or its IP address!
  562. .br
  563. Option groups: FD,SOCKET,IP4,IP6,TCP,LISTEN,OPENSSL,CHILD,RANGE,RETRY
  564. .br
  565. Useful options:
  566. pf,
  567. cipher,
  568. method,
  569. verify,
  570. cafile,
  571. capath,
  572. certificate,
  573. key,
  574. compress,
  575. fork,
  576. bind,
  577. range,
  578. tcpwrap,
  579. su,
  580. reuseaddr,
  581. retry
  582. .br
  583. See also:
  584. OPENSSL,
  585. TCP\-LISTEN
  586. .IP "\fB\f(CWPIPE:<filename>\fP\fP"
  587. If <filename> already exists, it is opened\&.
  588. If it does not exist, a named pipe is created and opened\&. Beginning with
  589. socat version 1\&.4\&.3, the named pipe is removed when the address is closed
  590. (but see option unlink\-close
  591. .br
  592. Note: When a pipe is used for both reading and writing, it works
  593. as echo service\&.
  594. .br
  595. Note: When a pipe is used for both reading and writing, and socat tries
  596. to write more bytes than the pipe can buffer (Linux 2\&.4: 2048 bytes), socat
  597. might block\&. Consider using socat option, e\&.g\&.,
  598. \f(CW\-b 2048\fP
  599. .br
  600. Option groups: FD,NAMED,OPEN
  601. .br
  602. Useful options:
  603. rdonly,
  604. nonblock,
  605. group,
  606. user,
  607. mode,
  608. unlink\-early
  609. .br
  610. See also: unnamed pipe
  611. .IP "\fB\f(CWPIPE\fP\fP"
  612. Creates an unnamed pipe and uses it for reading and writing\&. It works as an
  613. echo, because everything written
  614. to it appeares immediately as read data\&.
  615. .br
  616. Note: When socat tries to write more bytes than the pipe can queue (Linux
  617. 2\&.4: 2048 bytes), socat might block\&. Consider, e\&.g\&., using
  618. option
  619. \f(CW\-b 2048\fP
  620. .br
  621. Option groups: FD
  622. .br
  623. See also: named pipe
  624. .IP "\fB\f(CWPROXY:<proxy>:<hostname>:<port>\fP\fP"
  625. Connects to an HTTP proxy server on port 8080 using TCP/IP version 4 or 6
  626. depending on address specification, name resolution, or option
  627. pf, and sends a CONNECT
  628. request for hostname:port\&. If the proxy grants access and succeeds to
  629. connect to the target, data transfer between socat and the target can
  630. start\&. Note that the traffic need not be HTTP but can be an arbitrary
  631. protocol\&.
  632. .br
  633. Option groups: FD,SOCKET,IP4,IP6,TCP,HTTP,RETRY
  634. .br
  635. Useful options:
  636. proxyport,
  637. ignorecr,
  638. proxyauth,
  639. resolve,
  640. crnl,
  641. bind,
  642. connect\-timeout,
  643. mss,
  644. sourceport,
  645. retry
  646. .br
  647. See also: SOCKS, TCP
  648. .IP "\fB\f(CWPTY\fP\fP"
  649. Generates a pseudo terminal (pty) and uses its master side\&. Another process
  650. may open the pty\(cq\&s slave side using it like a serial line or terminal\&.
  651. (example)\&. If
  652. both the ptmx and the openpty mechanisms are available, ptmx is used
  653. (POSIX)\&.
  654. .br
  655. Option groups: FD,NAMED,PTY,TERMIOS
  656. .br
  657. Useful options:
  658. link,
  659. openpty,
  660. wait\-slave,
  661. mode,
  662. user,
  663. group
  664. .br
  665. See also:
  666. UNIX\-LISTEN,
  667. PIPE,
  668. EXEC, SYSTEM
  669. .IP "\fB\f(CWREADLINE\fP\fP"
  670. Uses GNU readline and history on stdio to allow editing and reusing input
  671. lines (example)\&. This requires the GNU readline and
  672. history libraries\&. Note that stdio should be a (pseudo) terminal device,
  673. otherwise readline does not seem to work\&.
  674. .br
  675. Option groups: FD,READLINE,TERMIOS
  676. .br
  677. Useful options:
  678. history,
  679. noecho
  680. .br
  681. See also:
  682. STDIO
  683. .IP "\fB\f(CWSCTP\-CONNECT:<host>:<port>\fP\fP"
  684. Establishes an SCTP stream connection to the specified <host> [IP
  685. address] and <port> [TCP service]
  686. using TCP/IP version 4 or 6 depending on address specification, name
  687. resolution, or option pf\&.
  688. .br
  689. Option groups: FD,SOCKET,IP4,IP6,SCTP,CHILD,RETRY
  690. .br
  691. Useful options:
  692. bind,
  693. pf,
  694. connect\-timeout,
  695. tos,
  696. mtudiscover,
  697. sctp\-maxseg,
  698. sctp\-nodelay,
  699. nonblock,
  700. sourceport,
  701. retry,
  702. readbytes
  703. .br
  704. See also:
  705. SCTP4\-CONNECT,
  706. SCTP6\-CONNECT,
  707. SCTP\-LISTEN,
  708. TCP\-CONNECT
  709. .IP "\fB\f(CWSCTP4\-CONNECT:<host>:<port>\fP\fP"
  710. Like SCTP\-CONNECT, but only supports IPv4 protocol\&.
  711. .br
  712. Option groups: FD,SOCKET,IP4,SCTP,CHILD,RETRY
  713. .br
  714. .IP "\fB\f(CWSCTP6\-CONNECT:<host>:<port>\fP\fP"
  715. Like SCTP\-CONNECT, but only supports IPv6 protocol\&.
  716. .br
  717. Option groups: FD,SOCKET,IP6,SCTP,CHILD,RETRY
  718. .br
  719. .IP "\fB\f(CWSCTP\-LISTEN:<port>\fP\fP"
  720. Listens on <port> [TCP service] and accepts a
  721. TCP/IP connection\&. The IP version is 4 or the one specified with
  722. address option pf, socat option
  723. (\-4, \-6), or environment variable SOCAT_DEFAULT_LISTEN_IP\&.
  724. Note that opening
  725. this address usually blocks until a client connects\&.
  726. .br
  727. Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6,SCTP,RETRY
  728. .br
  729. Useful options:
  730. crnl,
  731. fork,
  732. bind,
  733. range,
  734. tcpwrap,
  735. pf,
  736. max\-children,
  737. backlog,
  738. sctp\-maxseg,
  739. sctp\-nodelay,
  740. su,
  741. reuseaddr,
  742. retry,
  743. cool\-write
  744. .br
  745. See also:
  746. SCTP4\-LISTEN,
  747. SCTP6\-LISTEN,
  748. TCP\-LISTEN,
  749. SCTP\-CONNECT
  750. .IP "\fB\f(CWSCTP4\-LISTEN:<port>\fP\fP"
  751. Like SCTP\-LISTEN, but only supports IPv4
  752. protocol\&.
  753. .br
  754. Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,SCTP,RETRY
  755. .br
  756. .IP "\fB\f(CWSCTP6\-LISTEN:<port>\fP\fP"
  757. Like SCTP\-LISTEN, but only supports IPv6
  758. protocol\&.
  759. .br
  760. Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP6,SCTP,RETRY
  761. .br
  762. .IP "\fB\f(CWSOCKET\-CONNECT:<domain>:<protocol>:<remote\-address>\fP\fP"
  763. Creates a stream socket using the first and second given socket parameters
  764. and \f(CWSOCK_STREAM\fP (see man socket\e(2)) and connects to the remote\-address\&.
  765. The two socket parameters have to be specified by int
  766. numbers\&. Consult your OS documentation and include files to find the
  767. appropriate values\&. The remote\-address must be the data
  768. representation of a sockaddr structure without sa_family and (BSD) sa_len
  769. components\&.
  770. .br
  771. Please note that you can \- beyond the options of the specified groups \- also
  772. use options of higher level protocols when you apply socat option
  773. \-g\&.
  774. .br
  775. Option groups: FD,SOCKET,CHILD,RETRY
  776. .br
  777. Useful options:
  778. bind,
  779. setsockopt\-int,
  780. setsockopt\-bin,
  781. setsockopt\-string
  782. .br
  783. See also:
  784. TCP,
  785. UDP\-CONNECT,
  786. UNIX\-CONNECT,
  787. SOCKET\-LISTEN,
  788. SOCKET\-SENDTO
  789. .IP "\fB\f(CWSOCKET\-DATAGRAM:<domain>:<type>:<protocol>:<remote\-address>\fP\fP"
  790. Creates a datagram socket using the first three given socket parameters (see
  791. man socket\e(2)) and sends outgoing data to the remote\-address\&. The three
  792. socket parameters have to be specified by int
  793. numbers\&. Consult your OS documentation and include files to find the
  794. appropriate values\&. The remote\-address must be the data
  795. representation of a sockaddr structure without sa_family and (BSD) sa_len
  796. components\&.
  797. .br
  798. Please note that you can \- beyond the options of the specified groups \- also
  799. use options of higher level protocols when you apply socat option
  800. \-g\&.
  801. .br
  802. Option groups: FD,SOCKET,RANGE
  803. .br
  804. Useful options:
  805. bind,
  806. range,
  807. setsockopt\-int,
  808. setsockopt\-bin,
  809. setsockopt\-string
  810. .br
  811. See also:
  812. UDP\-DATAGRAM,
  813. IP\-DATAGRAM,
  814. SOCKET\-SENDTO,
  815. SOCKET\-RECV,
  816. SOCKET\-RECVFROM
  817. .IP "\fB\f(CWSOCKET\-LISTEN:<domain>:<protocol>:<local\-address>\fP\fP"
  818. Creates a stream socket using the first and second given socket parameters
  819. and \f(CWSOCK_STREAM\fP (see man socket\e(2)) and waits for incoming connections
  820. on local\-address\&. The two socket parameters have to be specified by
  821. int numbers\&. Consult your OS documentation and include files
  822. to find the appropriate values\&. The local\-address must be the
  823. data representation of a sockaddr structure without
  824. sa_family and (BSD) sa_len components\&.
  825. .br
  826. Please note that you can \- beyond the options of the specified groups \- also
  827. use options of higher level protocols when you apply socat option
  828. \-g\&.
  829. .br
  830. Option groups: FD,SOCKET,LISTEN,RANGE,CHILD,RETRY
  831. .br
  832. Useful options:
  833. setsockopt\-int,
  834. setsockopt\-bin,
  835. setsockopt\-string
  836. .br
  837. See also:
  838. TCP,
  839. UDP\-CONNECT,
  840. UNIX\-CONNECT,
  841. SOCKET\-LISTEN,
  842. SOCKET\-SENDTO,
  843. SOCKET\-SENDTO
  844. .IP "\fB\f(CWSOCKET\-RECV:<domain>:<type>:<protocol>:<local\-address>\fP\fP"
  845. Creates a socket using the three given socket parameters (see man socket\e(2))
  846. and binds it to <local\-address>\&. Receives arriving data\&. The three
  847. parameters have to be specified by int numbers\&. Consult your
  848. OS documentation and include files to find the appropriate values\&. The
  849. local\-address must be the data representation of a sockaddr
  850. structure without sa_family and (BSD) sa_len components\&.
  851. .br
  852. Option groups: FD,SOCKET,RANGE
  853. .br
  854. Useful options:
  855. range,
  856. setsockopt\-int,
  857. setsockopt\-bin,
  858. setsockopt\-string
  859. .br
  860. See also:
  861. UDP\-RECV,
  862. IP\-RECV,
  863. UNIX\-RECV,
  864. SOCKET\-DATAGRAM,
  865. SOCKET\-SENDTO,
  866. SOCKET\-RECVFROM
  867. .IP "\fB\f(CWSOCKET\-RECVFROM:<domain>:<type>:<protocol>:<local\-address>\fP\fP"
  868. Creates a socket using the three given socket parameters (see man socket\e(2))
  869. and binds it to <local\-address>\&. Receives arriving data and sends replies
  870. back to the sender\&. The first three parameters have to be specified as
  871. int numbers\&. Consult your OS documentation and include files
  872. to find the appropriate values\&. The local\-address must be the
  873. data representation of a sockaddr structure without
  874. sa_family and (BSD) sa_len components\&.
  875. .br
  876. Option groups: FD,SOCKET,CHILD,RANGE
  877. .br
  878. Useful options:
  879. fork,
  880. range,
  881. setsockopt\-int,
  882. setsockopt\-bin,
  883. setsockopt\-string
  884. .br
  885. See also:
  886. UDP\-RECVFROM,
  887. IP\-RECVFROM,
  888. UNIX\-RECVFROM,
  889. SOCKET\-DATAGRAM,
  890. SOCKET\-SENDTO,
  891. SOCKET\-RECV
  892. .IP "\fB\f(CWSOCKET\-SENDTO:<domain>:<type>:<protocol>:<remote\-address>\fP\fP"
  893. Creates a socket using the three given socket parameters (see man
  894. socket\e(2))\&. Sends outgoing data to the given address and receives replies\&.
  895. The three parameters have to be specified as int
  896. numbers\&. Consult your OS documentation and include files to find the
  897. appropriate values\&. The remote\-address must be the data
  898. representation of a sockaddr structure without sa_family and (BSD) sa_len
  899. components\&.
  900. .br
  901. Option groups: FD,SOCKET
  902. .br
  903. Useful options:
  904. bind,
  905. setsockopt\-int,
  906. setsockopt\-bin,
  907. setsockopt\-string
  908. .br
  909. See also:
  910. UDP\-SENDTO,
  911. IP\-SENDTO,
  912. UNIX\-SENDTO,
  913. SOCKET\-DATAGRAM,
  914. SOCKET\-RECV
  915. SOCKET\-RECVFROM
  916. .IP "\fB\f(CWSOCKS4:<socks\-server>:<host>:<port>\fP\fP"
  917. Connects via <socks\-server> [IP address]
  918. to <host> [IPv4 address]
  919. on <port> [TCP service],
  920. using socks version 4 protocol over IP version 4 or 6 depending on address specification, name resolution, or option
  921. pf (example)\&.
  922. .br
  923. Option groups: FD,SOCKET,IP4,IP6,TCP,SOCKS4,RETRY
  924. .br
  925. Useful options:
  926. socksuser,
  927. socksport,
  928. sourceport,
  929. pf,
  930. retry
  931. .br
  932. See also:
  933. SOCKS4A,
  934. PROXY,
  935. TCP
  936. .IP "\fB\f(CWSOCKS4A:<socks\-server>:<host>:<port>\fP\fP"
  937. like SOCKS4, but uses socks protocol version 4a, thus
  938. leaving host name resolution to the socks server\&.
  939. .br
  940. Option groups: FD,SOCKET,IP4,IP6,TCP,SOCKS4,RETRY
  941. .br
  942. .IP "\fB\f(CWSTDERR\fP\fP"
  943. Uses file descriptor 2\&.
  944. .br
  945. Option groups: FD (TERMIOS,REG,SOCKET)
  946. .br
  947. See also: FD
  948. .IP "\fB\f(CWSTDIN\fP\fP"
  949. Uses file descriptor 0\&.
  950. .br
  951. Option groups: FD (TERMIOS,REG,SOCKET)
  952. .br
  953. Useful options:
  954. readbytes
  955. .br
  956. See also: FD
  957. .IP "\fB\f(CWSTDIO\fP\fP"
  958. Uses file descriptor 0 for reading, and 1 for writing\&.
  959. .br
  960. Option groups: FD (TERMIOS,REG,SOCKET)
  961. .br
  962. Useful options:
  963. readbytes
  964. .br
  965. See also: FD
  966. .IP "\fB\f(CWSTDOUT\fP\fP"
  967. Uses file descriptor 1\&.
  968. .br
  969. Option groups: FD (TERMIOS,REG,SOCKET)
  970. .br
  971. See also: FD
  972. .IP "\fB\f(CWSYSTEM:<shell\-command>\fP\fP"
  973. Forks a sub process that establishes communication with its parent process
  974. and invokes the specified program with
  975. \f(CWsystem()\fP
  976. \&. Please note that
  977. <shell\-command> [string] must
  978. not contain \(cq\&,\(cq\& or \(dq\&!!\(dq\&, and that shell meta characters may have to be
  979. protected\&.
  980. After successful program start, \fBsocat\fP writes data to stdin of the
  981. process and reads from its stdout\&.
  982. .br
  983. Option groups: FD,SOCKET,EXEC,FORK,TERMIOS
  984. .br
  985. Useful options:
  986. path,
  987. fdin,
  988. fdout,
  989. chroot,
  990. su,
  991. su\-d,
  992. nofork,
  993. pty,
  994. stderr,
  995. ctty,
  996. setsid,
  997. pipes,
  998. sigint,
  999. sigquit
  1000. .br
  1001. See also: EXEC
  1002. .IP "\fB\f(CWTCP:<host>:<port>\fP\fP"
  1003. Connects to <port> [TCP service] on
  1004. <host> [IP address] using TCP/IP version 4 or 6
  1005. depending on address specification, name resolution, or option
  1006. pf\&.
  1007. .br
  1008. Option groups: FD,SOCKET,IP4,IP6,TCP,RETRY
  1009. .br
  1010. Useful options:
  1011. crnl,
  1012. bind,
  1013. pf,
  1014. connect\-timeout,
  1015. tos,
  1016. mtudiscover,
  1017. mss,
  1018. nodelay,
  1019. nonblock,
  1020. sourceport,
  1021. retry,
  1022. readbytes
  1023. .br
  1024. See also:
  1025. TCP4,
  1026. TCP6,
  1027. TCP\-LISTEN,
  1028. UDP,
  1029. SCTP\-CONNECT,
  1030. UNIX\-CONNECT
  1031. .IP "\fB\f(CWTCP4:<host>:<port>\fP\fP"
  1032. Like TCP, but only supports IPv4 protocol (example)\&.
  1033. .br
  1034. Option groups: FD,SOCKET,IP4,TCP,RETRY
  1035. .br
  1036. .IP "\fB\f(CWTCP6:<host>:<port>\fP\fP"
  1037. Like TCP, but only supports IPv6 protocol\&.
  1038. .br
  1039. Option groups: FD,SOCKET,IP6,TCP,RETRY
  1040. .br
  1041. .IP "\fB\f(CWTCP\-LISTEN:<port>\fP\fP"
  1042. Listens on <port> [TCP service] and accepts a
  1043. TCP/IP connection\&. The IP version is 4 or the one specified with
  1044. address option pf, socat option
  1045. (\-4, \-6), or environment variable SOCAT_DEFAULT_LISTEN_IP\&.
  1046. Note that opening
  1047. this address usually blocks until a client connects\&.
  1048. .br
  1049. Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6,TCP,RETRY
  1050. .br
  1051. Useful options:
  1052. crnl,
  1053. fork,
  1054. bind,
  1055. range,
  1056. tcpwrap,
  1057. pf,
  1058. max\-children,
  1059. backlog,
  1060. mss,
  1061. su,
  1062. reuseaddr,
  1063. retry,
  1064. cool\-write
  1065. .br
  1066. See also:
  1067. TCP4\-LISTEN,
  1068. TCP6\-LISTEN,
  1069. UDP\-LISTEN,
  1070. SCTP\-LISTEN,
  1071. UNIX\-LISTEN,
  1072. OPENSSL\-LISTEN,
  1073. TCP\-CONNECT
  1074. .IP "\fB\f(CWTCP4\-LISTEN:<port>\fP\fP"
  1075. Like TCP\-LISTEN, but only supports IPv4
  1076. protocol (example)\&.
  1077. .br
  1078. Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,TCP,RETRY
  1079. .br
  1080. .IP "\fB\f(CWTCP6\-LISTEN:<port>\fP\fP"
  1081. Like TCP\-LISTEN, but only supports IPv6
  1082. protocol\&.
  1083. .br
  1084. Additional useful option:
  1085. ipv6only
  1086. .br
  1087. Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP6,TCP,RETRY
  1088. .br
  1089. .IP "\fB\f(CWTUN[:<if\-addr>/<bits>]\fP\fP"
  1090. Creates a Linux TUN/TAP device and optionally assignes it the address and
  1091. netmask given by the parameters\&. The resulting network interface is almost
  1092. ready for use by other processes; socat serves its \(dq\&wire side\(dq\&\&. This address
  1093. requires read and write access to the tunnel cloning device, usually
  1094. \f(CW/dev/net/tun\fP
  1095. , as well as permission to set some \f(CWioctl()s\fP\&.
  1096. \fBOption iff\-up is required to immediately activate the interface!\fP
  1097. .br
  1098. Option groups: FD,NAMED,OPEN,TUN
  1099. .br
  1100. Useful options:
  1101. iff\-up,
  1102. tun\-device,
  1103. tun\-name,
  1104. tun\-type,
  1105. iff\-no\-pi
  1106. .br
  1107. See also:
  1108. ip\-recv
  1109. .IP "\fB\f(CWUDP:<host>:<port>\fP\fP"
  1110. Connects to <port> [UDP service] on
  1111. <host> [IP address] using UDP/IP version 4 or 6
  1112. depending on address specification, name resolution, or option
  1113. pf\&.
  1114. .br
  1115. Please note that,
  1116. due to UDP protocol properties, no real connection is established; data has
  1117. to be sent for `connecting\(cq\& to the server, and no end\-of\-file condition can
  1118. be transported\&.
  1119. .br
  1120. Option groups: FD,SOCKET,IP4,IP6
  1121. .br
  1122. Useful options:
  1123. ttl,
  1124. tos,
  1125. bind,
  1126. sourceport,
  1127. pf
  1128. .br
  1129. See also:
  1130. UDP4,
  1131. UDP6,
  1132. UDP\-LISTEN,
  1133. TCP,
  1134. IP
  1135. .IP "\fB\f(CWUDP4:<host>:<port>\fP\fP"
  1136. Like UDP, but only supports IPv4 protocol\&.
  1137. .br
  1138. Option groups: FD,SOCKET,IP4
  1139. .br
  1140. .IP "\fB\f(CWUDP6:<host>:<port>\fP\fP"
  1141. Like UDP, but only supports IPv6 protocol\&.
  1142. .br
  1143. Option groups: FD,SOCKET,IP6
  1144. .br
  1145. .IP "\fB\f(CWUDP\-DATAGRAM:<address>:<port>\fP\fP"
  1146. Sends outgoing data to the specified address which may in particular be a
  1147. broadcast or multicast address\&. Packets arriving on the local socket are
  1148. checked for the correct remote port and if their source addresses match
  1149. RANGE or TCPWRAP
  1150. options\&. This address type can for example be used for implementing
  1151. symmetric or asymmetric broadcast or multicast communications\&.
  1152. .br
  1153. Option groups: FD,SOCKET,IP4,IP6,RANGE
  1154. .br
  1155. Useful options:
  1156. bind,
  1157. range,
  1158. tcpwrap,
  1159. broadcast,
  1160. ip\-multicast\-loop,
  1161. ip\-multicast\-ttl,
  1162. ip\-multicast\-if,
  1163. ip\-add\-membership,
  1164. ttl,
  1165. tos,
  1166. sourceport,
  1167. pf
  1168. .br
  1169. See also:
  1170. UDP4\-DATAGRAM,
  1171. UDP6\-DATAGRAM,
  1172. UDP\-SENDTO,
  1173. UDP\-RECVFROM,
  1174. UDP\-RECV,
  1175. UDP\-CONNECT,
  1176. UDP\-LISTEN,
  1177. IP\-DATAGRAM
  1178. .IP "\fB\f(CWUDP4\-DATAGRAM:<address>:<port>\fP\fP"
  1179. Like UDP\-DATAGRAM, but only supports IPv4
  1180. protocol (example1,
  1181. example2)\&.
  1182. .br
  1183. Option groups: FD,SOCKET,IP4, RANGE
  1184. .IP "\fB\f(CWUDP6\-DATAGRAM:<address>:<port>\fP\fP"
  1185. Like UDP\-DATAGRAM, but only supports IPv6
  1186. protocol\&.
  1187. .br
  1188. Option groups: FD,SOCKET,IP6,RANGE
  1189. .IP "\fB\f(CWUDP\-LISTEN:<port>\fP\fP"
  1190. Waits for a UDP/IP packet arriving on <port>
  1191. [UDP service] and `connects\(cq\& back to sender\&.
  1192. The accepted IP version is 4 or the one specified with option
  1193. pf\&.
  1194. Please note that,
  1195. due to UDP protocol properties, no real connection is established; data has
  1196. to arrive from the peer first, and no end\-of\-file condition can be
  1197. transported\&. Note that opening
  1198. this address usually blocks until a client connects\&.
  1199. .br
  1200. Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6
  1201. .br
  1202. Useful options:
  1203. fork,
  1204. bind,
  1205. range,
  1206. pf
  1207. .br
  1208. See also:
  1209. UDP,
  1210. UDP4\-LISTEN,
  1211. UDP6\-LISTEN,
  1212. TCP\-LISTEN
  1213. .IP "\fB\f(CWUDP4\-LISTEN:<port>\fP\fP"
  1214. Like UDP\-LISTEN, but only support IPv4
  1215. protocol\&.
  1216. .br
  1217. Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4
  1218. .br
  1219. .IP "\fB\f(CWUDP6\-LISTEN:<port>\fP\fP"
  1220. Like UDP\-LISTEN, but only support IPv6
  1221. protocol\&.
  1222. .br
  1223. Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP6
  1224. .br
  1225. .IP "\fB\f(CWUDP\-SENDTO:<host>:<port>\fP\fP"
  1226. Communicates with the specified peer socket, defined by <port> [UDP
  1227. service] on
  1228. <host> [IP address], using UDP/IP version 4 or 6
  1229. depending on address specification, name resolution, or option
  1230. pf\&. It sends packets to and receives packets
  1231. from that peer socket only\&.
  1232. This address effectively implements a datagram client\&.
  1233. It works well with socat UDP\-RECVFROM and UDP\-RECV address peers\&.
  1234. .br
  1235. Option groups: FD,SOCKET,IP4,IP6
  1236. .br
  1237. Useful options:
  1238. ttl,
  1239. tos,
  1240. bind,
  1241. sourceport,
  1242. pf
  1243. .br
  1244. See also:
  1245. UDP4\-SENDTO,
  1246. UDP6\-SENDTO,
  1247. UDP\-RECVFROM,
  1248. UDP\-RECV,
  1249. UDP\-CONNECT,
  1250. UDP\-LISTEN,
  1251. IP\-SENDTO
  1252. .IP "\fB\f(CWUDP4\-SENDTO:<host>:<port>\fP\fP"
  1253. Like UDP\-SENDTO, but only supports IPv4
  1254. protocol\&.
  1255. .br
  1256. Option groups: FD,SOCKET,IP4
  1257. .IP "\fB\f(CWUDP6\-SENDTO:<host>:<port>\fP\fP"
  1258. Like UDP\-SENDTO, but only supports IPv6
  1259. protocol\&.
  1260. .br
  1261. Option groups: FD,SOCKET,IP6
  1262. .IP
  1263. .IP "\fB\f(CWUDP\-RECVFROM:<port>\fP\fP"
  1264. Creates a UDP socket on <port> [UDP service] using
  1265. UDP/IP version 4 or 6
  1266. depending on option pf\&.
  1267. It receives one packet from an unspecified peer and may send one or more
  1268. answer packets to that peer\&. This mode is particularly useful with fork
  1269. option
  1270. where each arriving packet \- from arbitrary peers \- is handled by its own sub
  1271. process\&. This allows a behaviour similar to typical UDP based servers like ntpd
  1272. or named\&. This address works well with socat UDP\-SENDTO address peers\&.
  1273. .br
  1274. Option groups: FD,SOCKET,IP4,IP6,CHILD,RANGE
  1275. .br
  1276. Useful options:
  1277. fork,
  1278. ttl,
  1279. tos,
  1280. bind,
  1281. sourceport,
  1282. pf
  1283. .br
  1284. See also:
  1285. UDP4\-RECVFROM,
  1286. UDP6\-RECVFROM,
  1287. UDP\-SENDTO,
  1288. UDP\-RECV,
  1289. UDP\-CONNECT,
  1290. UDP\-LISTEN,
  1291. IP\-RECVFROM,
  1292. UNIX\-RECVFROM
  1293. .IP "\fB\f(CWUDP4\-RECVFROM:<port>\fP\fP"
  1294. Like UDP\-RECVFROM, but only supports IPv4 protocol\&.
  1295. .br
  1296. Option groups: FD,SOCKET,IP4,CHILD,RANGE
  1297. .IP "\fB\f(CWUDP6\-RECVFROM:<port>\fP\fP"
  1298. Like UDP\-RECVFROM, but only supports IPv6 protocol\&.
  1299. .br
  1300. Option groups: FD,SOCKET,IP6,CHILD,RANGE
  1301. .IP
  1302. .IP "\fB\f(CWUDP\-RECV:<port>\fP\fP"
  1303. Creates a UDP socket on <port> [UDP service] using UDP/IP version 4 or 6
  1304. depending on option pf\&.
  1305. It receives packets from multiple unspecified peers and merges the data\&.
  1306. No replies are possible\&. It works well with, e\&.g\&., socat UDP\-SENDTO address peers; it behaves similar to a syslog server\&.
  1307. .br
  1308. Option groups: FD,SOCKET,IP4,IP6,RANGE
  1309. .br
  1310. Useful options:
  1311. fork,
  1312. pf,
  1313. bind,
  1314. sourceport,
  1315. ttl,
  1316. tos
  1317. .br
  1318. See also:
  1319. UDP4\-RECV,
  1320. UDP6\-RECV,
  1321. UDP\-SENDTO,
  1322. UDP\-RECVFROM,
  1323. UDP\-CONNECT,
  1324. UDP\-LISTEN,
  1325. IP\-RECV,
  1326. UNIX\-RECV
  1327. .IP "\fB\f(CWUDP4\-RECV:<port>\fP\fP"
  1328. Like UDP\-RECV, but only supports IPv4 protocol\&.
  1329. .br
  1330. Option groups: FD,SOCKET,IP4,RANGE
  1331. .IP "\fB\f(CWUDP6\-RECV:<port>\fP\fP"
  1332. Like UDP\-RECV, but only supports IPv6 protocol\&.
  1333. .br
  1334. Option groups: FD,SOCKET,IP6,RANGE
  1335. .IP
  1336. .IP "\fB\f(CWUNIX\-CONNECT:<filename>\fP\fP"
  1337. Connects to <filename> assuming it is a UNIX domain
  1338. socket\&.
  1339. If <filename> does not exist, this is an error;
  1340. if <filename> is not a UNIX domain socket, this is an error;
  1341. if <filename> is a UNIX domain socket, but no process is listening, this is
  1342. an error\&.
  1343. .br
  1344. Option groups: FD,SOCKET,NAMED,RETRY,UNIX
  1345. .br
  1346. )
  1347. Useful options:
  1348. bind
  1349. .br
  1350. See also:
  1351. UNIX\-LISTEN,
  1352. UNIX\-SENDTO,
  1353. TCP
  1354. .IP
  1355. .IP "\fB\f(CWUNIX\-LISTEN:<filename>\fP\fP"
  1356. Listens on <filename> using a UNIX domain stream
  1357. socket and accepts a connection\&.
  1358. If <filename> exists and is not a socket, this is an error\&.
  1359. If <filename> exists and is a UNIX domain socket, binding to the address
  1360. fails (use option unlink\-early!)\&.
  1361. Note that opening this address usually blocks until a client connects\&.
  1362. Beginning with socat version 1\&.4\&.3, the file system entry is removed when
  1363. this address is closed (but see option unlink\-close) (example)\&.
  1364. .br
  1365. Option groups: FD,SOCKET,NAMED,LISTEN,CHILD,RETRY,UNIX
  1366. .br
  1367. Useful options:
  1368. fork,
  1369. umask,
  1370. mode,
  1371. user,
  1372. group,
  1373. unlink\-early
  1374. .br
  1375. See also:
  1376. UNIX\-CONNECT,
  1377. UNIX\-RECVFROM,
  1378. UNIX\-RECV,
  1379. TCP\-LISTEN
  1380. .IP
  1381. .IP "\fB\f(CWUNIX\-SENDTO:<filename>\fP\fP"
  1382. Communicates with the specified peer socket, defined by [<filename>] assuming it is a UNIX domain datagram socket\&.
  1383. It sends packets to and receives packets from that peer socket only\&.
  1384. Please note that it might be neccessary to bind the
  1385. local socket to an address (e\&.g\&. \f(CW/tmp/sock1\fP, which must not exist
  1386. before)\&.
  1387. This address type works well with socat UNIX\-RECVFROM and UNIX\-RECV address
  1388. peers\&.
  1389. .br
  1390. Option groups: FD,SOCKET,NAMED,UNIX
  1391. .br
  1392. Useful options:
  1393. bind
  1394. .br
  1395. See also:
  1396. UNIX\-RECVFROM,
  1397. UNIX\-RECV,
  1398. UNIX\-CONNECT,
  1399. UDP\-SENDTO,
  1400. IP\-SENDTO
  1401. .IP
  1402. .IP "\fB\f(CWUNIX\-RECVFROM:<filename>\fP\fP"
  1403. Creates a UNIX domain datagram socket [<filename>]\&.
  1404. Receives one packet and may send one or more answer packets to that peer\&.
  1405. This mode is particularly useful with fork option where each arriving packet \- from arbitrary peers \- is handled by its own sub process\&.
  1406. This address works well with socat UNIX\-SENDTO address peers\&.
  1407. .br
  1408. Option groups: FD,SOCKET,NAMED,CHILD,UNIX
  1409. .br
  1410. Useful options:
  1411. fork
  1412. .br
  1413. See also:
  1414. UNIX\-SENDTO,
  1415. UNIX\-RECV,
  1416. UNIX\-LISTEN,
  1417. UDP\-RECVFROM,
  1418. IP\-RECVFROM
  1419. .IP
  1420. .IP "\fB\f(CWUNIX\-RECV:<filename>\fP\fP"
  1421. Creates a UNIX domain datagram socket [<filename>]\&.
  1422. Receives packets from multiple unspecified peers and merges the data\&.
  1423. No replies are possible\&. It can be, e\&.g\&., addressed by socat UNIX\-SENDTO address peers\&.
  1424. It behaves similar to a syslog server\&.
  1425. Option groups: FD,SOCKET,NAMED,UNIX
  1426. .br
  1427. See also:
  1428. UNIX\-SENDTO,
  1429. UNIX\-RECVFROM,
  1430. UNIX\-LISTEN,
  1431. UDP\-RECV,
  1432. IP\-RECV
  1433. .IP
  1434. .IP "\fB\f(CWUNIX\-CLIENT:<filename>\fP\fP"
  1435. Communicates with the specified peer socket, defined by
  1436. [<filename>] assuming it is a UNIX domain socket\&.
  1437. It first tries to connect and, if that fails, assumes it is a datagram
  1438. socket, thus supporting both types\&.
  1439. .br
  1440. Option groups: FD,SOCKET,NAMED,UNIX
  1441. .br
  1442. Useful options:
  1443. bind
  1444. .br
  1445. See also:
  1446. UNIX\-CONNECT,
  1447. UNIX\-SENDTO,
  1448. GOPEN
  1449. .IP
  1450. .IP "\fB\f(CWABSTRACT\-CONNECT:<string>\fP\fP"
  1451. .IP "\fB\f(CWABSTRACT\-LISTEN:<string>\fP\fP"
  1452. .IP "\fB\f(CWABSTRACT\-SENDTO:<string>\fP\fP"
  1453. .IP "\fB\f(CWABSTRACT\-RECVFROM:<string>\fP\fP"
  1454. .IP "\fB\f(CWABSTRACT\-RECV:<string>\fP\fP"
  1455. .IP "\fB\f(CWABSTRACT\-CLIENT:<string>\fP\fP"
  1456. The ABSTRACT addresses are almost identical to the related UNIX addresses
  1457. except that they do not address file system based sockets but an alternate
  1458. UNIX domain address space\&. To archieve this the socket address strings are
  1459. prefixed with \(dq\&\e0\(dq\& internally\&. This feature is available (only?) on Linux\&.
  1460. Option groups are the same as with the related UNIX addresses, except that
  1461. the ABSTRACT addresses are not member of the NAMED group\&.
  1462. .PP
  1463. .SH "ADDRESS OPTIONS"
  1464. .PP
  1465. Address options can be applied to address specifications to influence the
  1466. process of opening the addresses and the
  1467. properties of the resulting data channels\&.
  1468. .PP
  1469. For technical reasons not every option can be
  1470. applied to every address type; e\&.g\&., applying a socket option to a regular file
  1471. will fail\&. To catch most useless combinations as early as in the open phase,
  1472. the concept of \fIoption groups\fP was introduced\&. Each option belongs to one
  1473. or more option groups\&. Options can be used only with address types that support
  1474. at least one of their option groups (but see option \-g)\&.
  1475. .PP
  1476. Address options have data types that their values must conform to\&.
  1477. Every address option consists of just a keyword or a keyword followed by
  1478. \(dq\&=value\(dq\&, where value must conform to the options type\&.
  1479. Some address options manipulate parameters of system calls;
  1480. e\&.g\&., option sync sets the
  1481. \f(CWO_SYNC\fP
  1482. flag with the
  1483. \f(CWopen()\fP
  1484. call\&.
  1485. Other options cause a system or library call; e\&.g\&., with option `ttl=value\(cq\&
  1486. the
  1487. \f(CWsetsockopt(fd, SOL_IP, IP_TTL, value, sizeof(int))\fP
  1488. call is applied\&.
  1489. Other
  1490. options set internal \fBsocat\fP variables that are used during data transfer;
  1491. e\&.g\&., `crnl\(cq\& causes explicit character conversions\&.
  1492. A few options have more complex implementations; e\&.g\&., su\-d
  1493. (substuser\-delayed) inquires some user and group infos, stores them, and
  1494. applies them later after a possible
  1495. \f(CWchroot()\fP
  1496. call\&.
  1497. .PP
  1498. If multiple options are given to an address, their sequence in the address specification has (almost) no
  1499. effect on the sequence of their execution/application\&. Instead, \fBsocat\fP has
  1500. built in an \fIoption phase\fP model that tries to bring the options in a useful
  1501. order\&. Some options exist in different forms (e\&.g\&.,
  1502. unlink, unlink\-early, unlink\-late) to control the time of their execution\&.
  1503. .PP
  1504. If the same option is specified more than once within one address
  1505. specification, with equal or different values, the effect depends on the kind of option\&. Options
  1506. resulting in function calls like
  1507. \f(CWsetsockopt()\fP
  1508. cause multiple
  1509. invocations\&. With options that set parameters for a required call like
  1510. \f(CWopen()\fP
  1511. or set internal flags, the value of the last option occurrence is effective\&.
  1512. .PP
  1513. The existence or semantics of many options are system dependent\&. \fBSocat\fP
  1514. usually does NOT try to emulate missing libc or kernel features, it just
  1515. provides an
  1516. interface to the underlying system\&. So, if an operating system lacks a feature,
  1517. the related option is simply not available on this platform\&.
  1518. .PP
  1519. The following paragraphs introduce just the more common address options\&. For
  1520. a more comprehensive reference and to find information about canonical option
  1521. names, alias names, option phases, and platforms see file \fBxio\&.help\fP\&.
  1522. .br
  1523. .br
  1524. .PP
  1525. .br
  1526. .PP
  1527. \fI\fBFD option group\fP\fP
  1528. .PP
  1529. This option group contains options that are applied to a UN*X
  1530. style file descriptor, no matter how it was generated\&.
  1531. Because all current \fBsocat\fP address types are file descriptor based, these
  1532. options may be applied to any address\&.
  1533. .br
  1534. Note: Some of these options are also member of another option group, that
  1535. provides an other, non\-fd based mechanism\&.
  1536. For these options, it depends on the actual address type and its option groups
  1537. which mechanism is used\&. The second, non\-fd based mechanism is prioritized\&.
  1538. .IP "\fB\f(CWcloexec=<bool>\fP\fP"
  1539. Sets the
  1540. \f(CWFD_CLOEXEC\fP
  1541. flag with the
  1542. \f(CWfcntl()\fP
  1543. system call to value
  1544. <bool>\&. If set,
  1545. the file descriptor is closed on
  1546. \f(CWexec()\fP
  1547. family function calls\&. \fBSocat\fP
  1548. internally handles
  1549. this flag for the fds it controls, so in most cases there will be no need to
  1550. apply this option\&.
  1551. .IP "\fB\f(CWsetlk\fP\fP"
  1552. Tries to set a discretionary write lock to the whole file using the
  1553. \f(CWfcntl(fd,
  1554. F_SETLK, \&.\&.\&.)\fP
  1555. system call\&. If the file is already locked, this call results
  1556. in an error\&.
  1557. On Linux, when the file permissions for group are \(dq\&S\(dq\& (g\-x,g+s), and the
  1558. file system is locally mounted with the \(dq\&mand\(dq\& option, the lock is
  1559. mandatory, i\&.e\&. prevents other processes from opening the file\&.
  1560. .IP "\fB\f(CWsetlkw\fP\fP"
  1561. Tries to set a discretionary waiting write lock to the whole file using the
  1562. \f(CWfcntl(fd, F_SETLKW, \&.\&.\&.)\fP
  1563. system call\&. If the file is already locked,
  1564. this call blocks\&.
  1565. See option setlk for information about making this
  1566. lock mandatory\&.
  1567. .IP "\fB\f(CWsetlk\-rd\fP\fP"
  1568. Tries to set a discretionary read lock to the whole file using the
  1569. \f(CWfcntl(fd,
  1570. F_SETLK, \&.\&.\&.)\fP
  1571. system call\&. If the file is already write locked, this call
  1572. results in an error\&.
  1573. See option setlk for information about making this
  1574. lock mandatory\&.
  1575. .IP "\fB\f(CWsetlkw\-rd\fP\fP"
  1576. Tries to set a discretionary waiting read lock to the whole file using the
  1577. \f(CWfcntl(fd, F_SETLKW, \&.\&.\&.)\fP
  1578. system call\&. If the file is already write
  1579. locked, this call blocks\&.
  1580. See option setlk for information about making this
  1581. lock mandatory\&.
  1582. .IP "\fB\f(CWflock\-ex\fP\fP"
  1583. Tries to set a blocking exclusive advisory lock to the file using the
  1584. \f(CWflock(fd, LOCK_EX)\fP
  1585. system call\&. \fBSocat\fP hangs in this call if the file
  1586. is locked by another process\&.
  1587. .IP "\fB\f(CWflock\-ex\-nb\fP\fP"
  1588. Tries to set a nonblocking exclusive advisory lock to the file using the
  1589. \f(CWflock(fd, LOCK_EX|LOCK_NB)\fP
  1590. system call\&. If the file is already locked,
  1591. this option results in an error\&.
  1592. .IP "\fB\f(CWflock\-sh\fP\fP"
  1593. Tries to set a blocking shared advisory lock to the file using the
  1594. \f(CWflock(fd, LOCK_SH)\fP
  1595. system call\&. \fBSocat\fP hangs in this call if the file
  1596. is locked by another process\&.
  1597. .IP "\fB\f(CWflock\-sh\-nb\fP\fP"
  1598. Tries to set a nonblocking shared advisory lock to the file using the
  1599. \f(CWflock(fd, LOCK_SH|LOCK_NB)\fP
  1600. system call\&. If the file is already locked,
  1601. this option results in an error\&.
  1602. .IP "\fB\f(CWlock\fP\fP"
  1603. Sets a blocking lock on the file\&. Uses the setlk or flock mechanism
  1604. depending on availability on the particular platform\&. If both are available,
  1605. the POSIX variant (setlkw) is used\&.
  1606. .IP "\fB\f(CWuser=<user>\fP\fP"
  1607. Sets the <user> (owner) of the stream\&.
  1608. If the address is member of the NAMED option group,
  1609. \fBsocat\fP uses the
  1610. \f(CWchown()\fP
  1611. system call after opening the
  1612. file or binding to the UNIX domain socket (race condition!)\&.
  1613. Without filesystem entry, \fBsocat\fP sets the user of the stream
  1614. using the
  1615. \f(CWfchown()\fP
  1616. system call\&.
  1617. These calls might require root privilege\&.
  1618. .IP "\fB\f(CWuser\-late=<user>\fP\fP"
  1619. Sets the owner of the fd to <user> with the
  1620. \f(CWfchown()\fP
  1621. system call after opening
  1622. or connecting the channel\&.
  1623. This is useful only on file system entries\&.
  1624. .IP "\fB\f(CWgroup=<group>\fP\fP"
  1625. Sets the <group> of the stream\&.
  1626. If the address is member of the NAMED option group,
  1627. \fBsocat\fP uses the
  1628. \f(CWchown()\fP
  1629. system call after opening the
  1630. file or binding to the UNIX domain socket (race condition!)\&.
  1631. Without filesystem entry, \fBsocat\fP sets the group of the stream
  1632. with the
  1633. \f(CWfchown()\fP
  1634. system call\&.
  1635. These calls might require group membership or root privilege\&.
  1636. .IP "\fB\f(CWgroup\-late=<group>\fP\fP"
  1637. Sets the group of the fd to <group> with the
  1638. \f(CWfchown()\fP
  1639. system call after opening
  1640. or connecting the channel\&.
  1641. This is useful only on file system entries\&.
  1642. .IP "\fB\f(CWmode=<mode>\fP\fP"
  1643. Sets the <mode> [mode_t] (permissions) of the stream\&.
  1644. If the address is member of the NAMED option group and
  1645. uses the
  1646. \f(CWopen()\fP
  1647. or
  1648. \f(CWcreat()\fP
  1649. call, the mode is applied with these\&.
  1650. If the address is member of the NAMED option group with

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