PageRenderTime 73ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/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
  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 without using these
  1651. system calls, \fBsocat\fP uses the
  1652. \f(CWchmod()\fP
  1653. system call after opening the
  1654. filesystem entry or binding to the UNIX domain socket (race condition!)\&.
  1655. Otherwise, \fBsocat\fP sets the mode of the stream
  1656. using
  1657. \f(CWfchmod()\fP
  1658. \&.
  1659. These calls might require ownership or root privilege\&.
  1660. .IP "\fB\f(CWperm\-late=<mode>\fP\fP"
  1661. Sets the permissions of the fd to value <mode>
  1662. [mode_t] using the
  1663. \f(CWfchmod()\fP
  1664. system call after
  1665. opening or connecting the channel\&.
  1666. This is useful only on file system entries\&.
  1667. .IP "\fB\f(CWappend=<bool>\fP\fP"
  1668. Always writes data to the actual end of file\&.
  1669. If the address is member of the OPEN option group,
  1670. \fBsocat\fP uses the
  1671. \f(CWO_APPEND\fP
  1672. flag with the
  1673. \f(CWopen()\fP
  1674. system call
  1675. (example)\&.
  1676. Otherwise, \fBsocat\fP applies the
  1677. \f(CWfcntl(fd, F_SETFL, O_APPEND)\fP
  1678. call\&.
  1679. .IP "\fB\f(CWnonblock=<bool>\fP\fP"
  1680. Tries to open or use file in nonblocking mode\&. Its only effects are that the
  1681. \f(CWconnect()\fP
  1682. call of TCP addresses does not block, and that opening a
  1683. named pipe for reading does not block\&.
  1684. If the address is member of the OPEN option group,
  1685. \fBsocat\fP uses the
  1686. \f(CWO_NONBLOCK\fP
  1687. flag with the
  1688. \f(CWopen()\fP
  1689. system call\&.
  1690. Otherwise, \fBsocat\fP applies the
  1691. \f(CWfcntl(fd, F_SETFL, O_NONBLOCK)\fP
  1692. call\&.
  1693. .IP "\fB\f(CWbinary\fP\fP"
  1694. Opens the file in binary mode to avoid implicit line terminator
  1695. conversions (Cygwin)\&.
  1696. .IP "\fB\f(CWtext\fP\fP"
  1697. Opens the file in text mode to force implicit line terminator conversions
  1698. (Cygwin)\&.
  1699. .IP "\fB\f(CWnoinherit\fP\fP"
  1700. Does not keep this file open in a spawned process (Cygwin)\&.
  1701. .IP "\fB\f(CWcool\-write\fP\fP"
  1702. Takes it easy when write fails with EPIPE or ECONNRESET and logs the message
  1703. with \fInotice\fP level instead of \fIerror\fP\&.
  1704. This prevents the log file from being filled with useless error messages
  1705. when socat is used as a high volume server or proxy where clients often
  1706. abort the connection\&.
  1707. .br
  1708. This option is experimental\&.
  1709. .IP "\fB\f(CWend\-close\fP\fP"
  1710. Changes the (address dependent) method of ending a connection to just close
  1711. the file descriptors\&. This is useful when the connection is to be reused by
  1712. or shared with other processes (example)\&.
  1713. .br
  1714. Normally, socket connections will be ended with \f(CWshutdown(2)\fP which
  1715. terminates the socket even if it is shared by multiple processes\&.
  1716. \f(CWclose(2)\fP \(dq\&unlinks\(dq\& the socket from the process but keeps it active as
  1717. long as there are still links from other processes\&.
  1718. .br
  1719. Similarly, when an address of type EXEC or SYSTEM is ended, socat usually
  1720. will explicitely kill the sub process\&. With this option, it will just close
  1721. the file descriptors\&.
  1722. .IP "\fB\f(CWshut\-none\fP\fP"
  1723. Changes the (address dependent) method of shutting down the write part of a
  1724. connection to not do anything\&.
  1725. .IP "\fB\f(CWshut\-down\fP\fP"
  1726. Changes the (address dependent) method of shutting down the write part of a
  1727. connection to \f(CWshutdown\e(fd, SHUT_WR)\fP\&. Is only useful with sockets\&.
  1728. .IP "\fB\f(CWshut\-close\fP\fP"
  1729. Changes the (address dependent) method of shutting down the write part of a
  1730. connection to \f(CWclose\e(fd)\fP\&.
  1731. .IP "\fB\f(CWshut\-null\fP\fP"
  1732. When one address indicates EOF, \fBsocat\fP will send a zero sized packet to the
  1733. write channel of the other address to transfer the EOF condition\&. This is
  1734. useful with UDP and other datagram protocols\&. Has been tested against
  1735. netcat and socat with option null\-eof\&.
  1736. .IP "\fB\f(CWnull\-eof\fP\fP"
  1737. Normally \fBsocat\fP will ignore empty (zero size payload) packets arriving on
  1738. datagram sockets, so it survives port scans\&. With this option \fBsocat\fP
  1739. interprets empty datagram packets as EOF indicator (see
  1740. shut\-null)\&.
  1741. .IP "\fB\f(CWioctl\-void=<request>\fP\fP"
  1742. Calls \f(CWioctl()\fP with the request value as second argument and NULL as
  1743. third argument\&. This option allows to utilize ioctls that are not
  1744. explicitely implemented in socat\&.
  1745. .IP "\fB\f(CWioctl\-int=<request>:<value>\fP\fP"
  1746. Calls \f(CWioctl()\fP with the request value as second argument and the integer
  1747. value as third argument\&.
  1748. .IP "\fB\f(CWioctl\-intp=<request>:<value>\fP\fP"
  1749. Calls \f(CWioctl()\fP with the request value as second argument and a pointer to
  1750. the integer value as third argument\&.
  1751. .IP "\fB\f(CWioctl\-bin=<request>:<value>\fP\fP"
  1752. Calls \f(CWioctl()\fP with the request value as second argument and a pointer to
  1753. the given data value as third argument\&. This data must be specified in
  1754. <dalan> form\&.
  1755. .IP "\fB\f(CWioctl\-string=<request>:<value>\fP\fP"
  1756. Calls \f(CWioctl()\fP with the request value as second argument and a pointer to
  1757. the given string as third argument\&.
  1758. <dalan> form\&.
  1759. .PP
  1760. .br
  1761. .PP
  1762. \fI\fBNAMED option group\fP\fP
  1763. .PP
  1764. These options work on file system entries\&.
  1765. .br
  1766. See also options user, group, and
  1767. mode\&.
  1768. .PP
  1769. .IP "\fB\f(CWuser\-early=<user>\fP\fP"
  1770. Changes the <user> (owner) of the file system entry before
  1771. accessing it, using the
  1772. \f(CWchown()\fP
  1773. system call\&. This call might require root privilege\&.
  1774. .IP "\fB\f(CWgroup\-early=<group>\fP\fP"
  1775. Changes the <group> of the file system entry before
  1776. accessing it, using the
  1777. \f(CWchown()\fP
  1778. system call\&. This call might require group membership or root
  1779. privilege\&.
  1780. .IP "\fB\f(CWperm\-early=<mode>\fP\fP"
  1781. Changes the <mode> [mode_t] of the file system entry
  1782. before accessing it, using the
  1783. \f(CWchmod()\fP
  1784. system call\&. This call might require ownership or root
  1785. privilege\&.
  1786. .IP "\fB\f(CWumask=<mode>\fP\fP"
  1787. Sets the umask of the process to <mode> [mode_t] before
  1788. accessing the file system entry (useful
  1789. with UNIX domain sockets!)\&. This call might affect all further operations
  1790. of the \fBsocat\fP process!
  1791. .IP "\fB\f(CWunlink\-early\fP\fP"
  1792. Unlinks (removes) the file before opening it and even before applying
  1793. user\-early etc\&.
  1794. .IP "\fB\f(CWunlink\fP\fP"
  1795. Unlinks (removes) the file before accessing it, but after user\-early etc\&.
  1796. .IP "\fB\f(CWunlink\-late\fP\fP"
  1797. Unlinks (removes) the file after opening it to make it inaccessible for
  1798. other processes after a short race condition\&.
  1799. .IP "\fB\f(CWunlink\-close\fP\fP"
  1800. Removes the addresses file system entry when closing the address\&.
  1801. For named pipes,
  1802. listening unix domain sockets,
  1803. and the symbolic links of pty addresses,
  1804. the default is 1; for created files,
  1805. opened files,
  1806. generic opened files, and
  1807. client unix domain sockets the default is 0\&.
  1808. .PP
  1809. .br
  1810. .PP
  1811. \fI\fBOPEN option group\fP\fP
  1812. .PP
  1813. The OPEN group options allow to set flags with the
  1814. \f(CWopen()\fP
  1815. system call\&.
  1816. E\&.g\&., option `creat\(cq\& sets the
  1817. \f(CWO_CREAT\fP
  1818. flag\&.
  1819. .br
  1820. See also options append and
  1821. nonblock\&.
  1822. .IP "\fB\f(CWcreat=<bool>\fP\fP"
  1823. Creates the file if it does not exist (example)\&.
  1824. .IP "\fB\f(CWdsync=<bool>\fP\fP"
  1825. Blocks
  1826. \f(CWwrite()\fP
  1827. calls until metainfo is physically written to media\&.
  1828. .IP "\fB\f(CWexcl=<bool>\fP\fP"
  1829. With option creat, if file exists this is an error\&.
  1830. .IP "\fB\f(CWlargefile=<bool>\fP\fP"
  1831. On 32 bit systems, allows a file larger than 2^31 bytes\&.
  1832. .IP "\fB\f(CWnoatime\fP\fP"
  1833. Sets the O_NOATIME options, so reads do not change the access timestamp\&.
  1834. .IP "\fB\f(CWnoctty=<bool>\fP\fP"
  1835. Does not make this file the controlling terminal\&.
  1836. .IP "\fB\f(CWnofollow=<bool>\fP\fP"
  1837. Does not follow symbolic links\&.
  1838. .IP "\fB\f(CWnshare=<bool>\fP\fP"
  1839. Does not allow to share this file with other processes\&.
  1840. .IP "\fB\f(CWrshare=<bool>\fP\fP"
  1841. Does not allow other processes to open this file for writing\&.
  1842. .IP "\fB\f(CWrsync=<bool>\fP\fP"
  1843. Blocks
  1844. \f(CWwrite()\fP
  1845. until metainfo is physically written to media\&.
  1846. .IP "\fB\f(CWsync=<bool>\fP\fP"
  1847. Blocks
  1848. \f(CWwrite()\fP
  1849. until data is physically written to media\&.
  1850. .IP "\fB\f(CWrdonly=<bool>\fP\fP"
  1851. Opens the file for reading only\&.
  1852. .IP "\fB\f(CWwronly=<bool>\fP\fP"
  1853. Opens the file for writing only\&.
  1854. .IP "\fB\f(CWtrunc\fP\fP"
  1855. Truncates the file to size 0 during opening it\&.
  1856. .PP
  1857. .br
  1858. .PP
  1859. \fI\fBREG and BLK option group\fP\fP
  1860. .PP
  1861. These options are usually applied to a UN*X file descriptor, but their
  1862. semantics make sense only on a file supporting random access\&.
  1863. .IP "\fB\f(CWseek=<offset>\fP\fP"
  1864. Applies the
  1865. \f(CWlseek(fd, <offset>, SEEK_SET)\fP
  1866. (or
  1867. \f(CWlseek64\fP
  1868. ) system
  1869. call, thus positioning the file pointer absolutely to <offset>
  1870. [off_t or off64_t]\&. Please note that a
  1871. missing value defaults to 1, not 0\&.
  1872. .IP "\fB\f(CWseek\-cur=<offset>\fP\fP"
  1873. Applies the
  1874. \f(CWlseek(fd, <offset>, SEEK_CUR)\fP
  1875. (or
  1876. \f(CWlseek64\fP
  1877. ) system
  1878. call, thus positioning the file pointer <offset> [off_t or
  1879. off64_t] bytes relatively to its current position (which
  1880. is usually 0)\&. Please note that a missing value defaults to 1, not 0\&.
  1881. .IP "\fB\f(CWseek\-end=<offset>\fP\fP"
  1882. Applies the
  1883. \f(CWlseek(fd, <offset>, SEEK_END)\fP
  1884. (or
  1885. \f(CWlseek64\fP
  1886. ) system
  1887. call, thus positioning the file pointer <offset> [off_t or
  1888. off64_t] bytes relatively to the files current end\&. Please
  1889. note that a missing value defaults to 1, not 0\&.
  1890. .IP "\fB\f(CWftruncate=<offset>\fP\fP"
  1891. Applies the
  1892. \f(CWftruncate(fd, <offset>)\fP
  1893. (or
  1894. \f(CWftruncate64\fP
  1895. if available) system call, thus
  1896. truncating the file at the position <offset> [off_t or
  1897. off64_t]\&. Please note that a missing value defaults to 1,
  1898. not 0\&.
  1899. .IP
  1900. .IP "\fB\f(CWsecrm=<bool>\fP\fP"
  1901. .IP "\fB\f(CWunrm=<bool>\fP\fP"
  1902. .IP "\fB\f(CWcompr=<bool>\fP\fP"
  1903. .IP "\fB\f(CWext2\-sync=<bool>\fP\fP"
  1904. .IP "\fB\f(CWimmutable=<bool>\fP\fP"
  1905. .IP "\fB\f(CWext2\-append=<bool>\fP\fP"
  1906. .IP "\fB\f(CWnodump=<bool>\fP\fP"
  1907. .IP "\fB\f(CWext2\-noatime=<bool>\fP\fP"
  1908. .IP "\fB\f(CWjournal\-data=<bool>\fP\fP"
  1909. .IP "\fB\f(CWnotail=<bool>\fP\fP"
  1910. .IP "\fB\f(CWdirsync=<bool>\fP\fP"
  1911. These options change non standard file attributes on operating systems and
  1912. file systems that support these features, like Linux with ext2fs,
  1913. ext3fs, or reiserfs\&. See man 1 chattr for information on these options\&.
  1914. Please note that there might be a race condition between creating the file
  1915. and applying these options\&.
  1916. .PP
  1917. .br
  1918. .PP
  1919. \fI\fBPROCESS option group\fP\fP
  1920. .PP
  1921. Options of this group change the process properties instead of just affecting
  1922. one data channel\&.
  1923. For EXEC and SYSTEM addresses and for LISTEN and CONNECT type addresses with
  1924. option FORK,
  1925. these options apply to the child processes instead of the main socat process\&.
  1926. .IP "\fB\f(CWchroot=<directory>\fP\fP"
  1927. Performs a
  1928. \f(CWchroot()\fP
  1929. operation to <directory>
  1930. after processing the address (example)\&. This call might require root privilege\&.
  1931. .IP "\fB\f(CWchroot\-early=<directory>\fP\fP"
  1932. Performs a
  1933. \f(CWchroot()\fP
  1934. operation to <directory>
  1935. before opening the address\&. This call might require root privilege\&.
  1936. .IP "\fB\f(CWsetgid=<group>\fP\fP"
  1937. Changes the primary <group> of the process after
  1938. processing the address\&. This call might require root privilege\&. Please note
  1939. that this option does not drop other group related privileges\&.
  1940. .IP "\fB\f(CWsetgid\-early=<group>\fP\fP"
  1941. Like setgit but is performed before opening the address\&.
  1942. .IP "\fB\f(CWsetuid=<user>\fP\fP"
  1943. Changes the <user> (owner) of the process after processing
  1944. the address\&. This call might require root privilege\&. Please note that this
  1945. option does not drop group related privileges\&. Check if option
  1946. su better fits your needs\&.
  1947. .IP "\fB\f(CWsetuid\-early=<user>\fP\fP"
  1948. Like setuid but is performed before opening the
  1949. address\&.
  1950. .IP "\fB\f(CWsu=<user>\fP\fP"
  1951. Changes the <user> (owner) and groups of the process after
  1952. processing the address (example)\&. This call might require root privilege\&.
  1953. .IP "\fB\f(CWsu\-d=<user>\fP\fP"
  1954. Short name for \f(CWsubstuser\-delayed\fP\&.
  1955. Changes the <user>
  1956. (owner) and groups of the process after processing the address (example)\&.
  1957. The user and his groups are retrieved \fIbefore\fP a possible
  1958. \f(CWchroot()\fP
  1959. \&. This call might require root privilege\&.
  1960. .IP "\fB\f(CWsetpgid=<pid_t>\fP\fP"
  1961. Makes the process a member of the specified process group
  1962. <pid_t>\&. If no value
  1963. is given, or if the value is 0 or 1, the process becomes leader of a new
  1964. process group\&.
  1965. .IP "\fB\f(CWsetsid\fP\fP"
  1966. Makes the process the leader of a new session (example)\&.
  1967. .PP
  1968. .br
  1969. .PP
  1970. \fI\fBREADLINE option group\fP\fP
  1971. .PP
  1972. These options apply to the readline address type\&.
  1973. .IP "\fB\f(CWhistory=<filename>\fP\fP"
  1974. Reads and writes history from/to <filename> (example)\&.
  1975. .IP "\fB\f(CWnoprompt\fP\fP"
  1976. Since version 1\&.4\&.0, socat per default tries to determine a prompt \-
  1977. that is then passed to the readline call \- by remembering the last
  1978. incomplete line of the output\&. With this option, socat does not pass a
  1979. prompt to readline, so it begins line editing in the first column
  1980. of the terminal\&.
  1981. .IP "\fB\f(CWnoecho=<pattern>\fP\fP"
  1982. Specifies a regular pattern for a prompt that prevents the following input
  1983. line from being displayed on the screen and from being added to the history\&.
  1984. The prompt is defined as the text that was output to the readline address
  1985. after the lastest newline character and before an input character was
  1986. typed\&. The pattern is a regular expression, e\&.g\&.
  1987. \(dq\&^[Pp]assword:\&.*$\(dq\& or \(dq\&([Uu]ser:|[Pp]assword:)\(dq\&\&. See regex\e(7) for details\&.
  1988. (example)
  1989. .IP "\fB\f(CWprompt=<string>\fP\fP"
  1990. Passes the string as prompt to the readline function\&. readline prints this
  1991. prompt when stepping through the history\&. If this string matches a constant
  1992. prompt issued by an interactive program on the other socat address,
  1993. consistent look and feel can be archieved\&.
  1994. .PP
  1995. .br
  1996. .PP
  1997. \fI\fBAPPLICATION option group\fP\fP
  1998. .PP
  1999. This group contains options that work at data level\&.
  2000. Note that these options only apply to the \(dq\&raw\(dq\& data transferred by socat,
  2001. but not to protocol data used by addresses like
  2002. PROXY\&.
  2003. .IP "\fB\f(CWcr\fP\fP"
  2004. Converts the default line termination character NL (\(cq\&\en\(cq\&, 0x0a) to/from CR
  2005. (\(cq\&\er\(cq\&, 0x0d) when writing/reading on this channel\&.
  2006. .IP "\fB\f(CWcrnl\fP\fP"
  2007. Converts the default line termination character NL (\(cq\&\en\(cq\&, 0x0a) to/from CRNL
  2008. (\(dq\&\er\en\(dq\&, 0x0d0a) when writing/reading on this channel (example)\&.
  2009. Note: socat simply strips all CR characters\&.
  2010. .IP "\fB\f(CWignoreeof\fP\fP"
  2011. When EOF occurs on this channel, \fBsocat\fP ignores it and tries to read more
  2012. data (like \(dq\&tail \-f\(dq\&) (example)\&.
  2013. .IP "\fB\f(CWreadbytes=<bytes>\fP\fP"
  2014. \fBsocat\fP reads only so many bytes from this address (the address provides
  2015. only so many bytes for transfer and pretends to be at EOF afterwards)\&.
  2016. Must be greater than 0\&.
  2017. .IP "\fB\f(CWlockfile=<filename>\fP\fP"
  2018. If lockfile exists, exits with error\&. If lockfile does not exist, creates it
  2019. and continues, unlinks lockfile on exit\&.
  2020. .IP "\fB\f(CWwaitlock=<filename>\fP\fP"
  2021. If lockfile exists, waits until it disappears\&. When lockfile does not exist,
  2022. creates it and continues, unlinks lockfile on exit\&.
  2023. .IP "\fB\f(CWescape=<int>\fP\fP"
  2024. Specifies the numeric code of a character that triggers EOF on the input
  2025. stream\&. It is useful with a terminal in raw mode
  2026. (example)\&.
  2027. .PP
  2028. .br
  2029. .PP
  2030. \fI\fBSOCKET option group\fP\fP
  2031. .PP
  2032. These options are intended for all kinds of sockets, e\&.g\&. IP or UNIX domain\&. Most are applied with a
  2033. \f(CWsetsockopt()\fP
  2034. call\&.
  2035. .IP "\fB\f(CWbind=<sockname>\fP\fP"
  2036. Binds the socket to the given socket address using the
  2037. \f(CWbind()\fP
  2038. system
  2039. call\&. The form of <sockname> is socket domain dependent:
  2040. IP4 and IP6 allow the form [hostname|hostaddress][:(service|port)] (example),
  2041. UNIX domain sockets require <filename>\&.
  2042. .IP "\fB\f(CWconnect\-timeout=<seconds>\fP\fP"
  2043. Abort the connection attempt after <seconds> [timeval]
  2044. with error status\&.
  2045. .IP "\fB\f(CWso\-bindtodevice=<interface>\fP\fP"
  2046. Binds the socket to the given <interface>\&.
  2047. This option might require root privilege\&.
  2048. .IP "\fB\f(CWbroadcast\fP\fP"
  2049. For datagram sockets, allows sending to broadcast addresses and receiving
  2050. packets addressed to broadcast addresses\&.
  2051. .IP "\fB\f(CWdebug\fP\fP"
  2052. Enables socket debugging\&.
  2053. .IP "\fB\f(CWdontroute\fP\fP"
  2054. Only communicates with directly connected peers, does not use routers\&.
  2055. .IP "\fB\f(CWkeepalive\fP\fP"
  2056. Enables sending keepalives on the socket\&.
  2057. .IP "\fB\f(CWlinger=<seconds>\fP\fP"
  2058. Blocks
  2059. \f(CWshutdown()\fP
  2060. or
  2061. \f(CWclose()\fP
  2062. until data transfers have finished
  2063. or the given timeout [int] expired\&.
  2064. .IP "\fB\f(CWoobinline\fP\fP"
  2065. Places out\-of\-band data in the input data stream\&.
  2066. .IP "\fB\f(CWpriority=<priority>\fP\fP"
  2067. Sets the protocol defined <priority> [<int>] for outgoing
  2068. packets\&.
  2069. .IP "\fB\f(CWrcvbuf=<bytes>\fP\fP"
  2070. Sets the size of the receive buffer after the
  2071. \f(CWsocket()\fP
  2072. call to
  2073. <bytes> [int]\&. With TCP
  2074. sockets, this value corresponds to the socket\(cq\&s maximal window size\&.
  2075. .IP "\fB\f(CWrcvbuf\-late=<bytes>\fP\fP"
  2076. Sets the size of the receive buffer when the socket is already
  2077. connected to <bytes> [int]\&.
  2078. With TCP sockets, this value corresponds to the socket\(cq\&s
  2079. maximal window size\&.
  2080. .IP "\fB\f(CWrcvlowat=<bytes>\fP\fP"
  2081. Specifies the minimum number of received bytes [int] until
  2082. the socket layer will pass the buffered data to \fBsocat\fP\&.
  2083. .IP "\fB\f(CWrcvtimeo=<seconds>\fP\fP"
  2084. Sets the receive timeout [timeval]\&.
  2085. .IP "\fB\f(CWreuseaddr\fP\fP"
  2086. Allows other sockets to bind to an address even if parts of it (e\&.g\&. the
  2087. local port) are already in use by \fBsocat\fP (example)\&.
  2088. .IP "\fB\f(CWsndbuf=<bytes>\fP\fP"
  2089. Sets the size of the send buffer after the
  2090. \f(CWsocket()\fP
  2091. call to
  2092. <bytes> [int]\&.
  2093. .IP "\fB\f(CWsndbuf\-late=<bytes>\fP\fP"
  2094. Sets the size of the send buffer when the socket is connected to
  2095. <bytes> [int]\&.
  2096. .IP "\fB\f(CWsndlowat=<bytes>\fP\fP"
  2097. Specifies the minimum number of bytes in the send buffer until the socket
  2098. layer will send the data to <bytes> [int]\&.
  2099. .IP "\fB\f(CWsndtimeo=<seconds>\fP\fP"
  2100. Sets the send timeout to seconds [timeval]\&.
  2101. .IP "\fB\f(CWpf=<string>\fP\fP"
  2102. Forces the use of the specified IP version or protocol\&. <string> can be
  2103. something like \(dq\&ip4\(dq\& or \(dq\&ip6\(dq\&\&. The resulting value is
  2104. used as first argument to the
  2105. \f(CWsocket()\fP
  2106. or
  2107. \f(CWsocketpair()\fP
  2108. calls\&.
  2109. This option affects address resolution and the required syntax of bind and
  2110. range options\&.
  2111. .IP "\fB\f(CWtype=<type>\fP\fP"
  2112. Sets the type of the socket, specified as second argument to the
  2113. \f(CWsocket()\fP
  2114. or
  2115. \f(CWsocketpair()\fP
  2116. calls, to <type>
  2117. [int]\&. Address resolution is not affected by this option\&.
  2118. Under Linux, 1 means stream oriented socket, 2 means datagram socket, and 3
  2119. means raw socket\&.
  2120. .IP "\fB\f(CWprototype\fP\fP"
  2121. Sets the protocol of the socket, specified as third argument to the
  2122. \f(CWsocket()\fP
  2123. or
  2124. \f(CWsocketpair()\fP
  2125. calls, to <prototype>
  2126. [int]\&. Address resolution is not affected by this option\&.
  2127. 6 means TCP, 17 means UDP\&.
  2128. .IP "\fB\f(CWso\-timestamp\fP\fP"
  2129. Sets the SO_TIMESTAMP socket option\&. This enables receiving and logging of
  2130. timestamp ancillary messages\&.
  2131. .IP "\fB\f(CWsetsockopt\-int=<level>:<optname>:<optval>\fP\fP"
  2132. Invokes \f(CWsetsockopt()\fP for the socket with the given parameters\&. \f(CWlevel\fP
  2133. [int] is used as second argument to \f(CWsetsockopt()\fP and
  2134. specifies the layer, e\&.g\&. SOL_TCP for TCP (6 on Linux), or SOL_SOCKET for
  2135. the socket layer (1 on Linux)\&. \f(CWoptname\fP [int] is the
  2136. third argument to \f(CWsetsockopt()\fP and tells which socket option is to be
  2137. set\&. For the actual numbers you might have to look up the appropriate include
  2138. files of your system\&. The 4th \f(CWsetsockopt()\fP parameter, \f(CWvalue\fP
  2139. [int], is passed to the function per pointer, and for the
  2140. length parameter sizeof\e(int) is taken implicitely\&.
  2141. .IP "\fB\f(CWsetsockopt\-bin=<level>:<optname>:<optval>\fP\fP"
  2142. Like \f(CWsetsockopt\-int\fP, but <optval> must be provided in
  2143. dalan format and specifies an arbitrary sequence of bytes;
  2144. the length parameter is automatically derived from the data\&.
  2145. .IP "\fB\f(CWsetsockopt\-string=<level>:<optname>:<optval>\fP\fP"
  2146. Like \f(CWsetsockopt\-int\fP, but <optval> must be a string\&.
  2147. This string is passed to the function with trailing null character, and the
  2148. length parameter is automatically derived from the data\&.
  2149. .PP
  2150. .br
  2151. .PP
  2152. \fI\fBUNIX option group\fP\fP
  2153. .PP
  2154. These options apply to UNIX domain based addresses\&.
  2155. .IP "\fB\f(CWunix\-tightsocklen=[0|1]\fP\fP"
  2156. On socket operations, pass a socket address length that does not include the
  2157. whole
  2158. \f(CWstruct sockaddr_un\fP
  2159. record but (besides other components) only
  2160. the relevant part of the filename or abstract string\&. Default is 1\&.
  2161. .PP
  2162. \fI\fBIP4 and IP6 option groups\fP\fP
  2163. .PP
  2164. These options can be used with IPv4 and IPv6 based sockets\&.
  2165. .IP "\fB\f(CWtos=<tos>\fP\fP"
  2166. Sets the TOS (type of service) field of outgoing packets to <tos>
  2167. [byte] (see RFC 791)\&.
  2168. .IP "\fB\f(CWttl=<ttl>\fP\fP"
  2169. Sets the TTL (time to live) field of outgoing packets to <ttl>
  2170. [byte]\&.
  2171. .IP "\fB\f(CWip\-options=<data>\fP\fP"
  2172. Sets IP options like source routing\&. Must be given in binary form,
  2173. recommended format is a leading \(dq\&x\(dq\& followed by an even number of hex
  2174. digits\&. This option may be used multiple times, data are appended\&.
  2175. E\&.g\&., to connect to host 10\&.0\&.0\&.1 via some gateway using a loose source
  2176. route, use the gateway as address parameter and set a loose source route
  2177. using the option
  2178. \f(CWip\-options=x8307040a000001\fP
  2179. \&.
  2180. .br
  2181. IP options are defined in RFC 791\&.
  2182. .br
  2183. .IP "\fB\f(CWmtudiscover=<0|1|2>\fP\fP"
  2184. Takes 0, 1, 2 to never, want, or always use path MTU discover on this
  2185. socket\&.
  2186. .IP "\fB\f(CWip\-pktinfo\fP\fP"
  2187. Sets the IP_PKTINFO socket option\&. This enables receiving and logging of
  2188. ancillary messages containing destination address and interface (Linux)
  2189. (example)\&.
  2190. .IP "\fB\f(CWip\-recverr\fP\fP"
  2191. Sets the IP_RECVERR socket option\&. This enables receiving and logging of
  2192. ancillary messages containing detailled error information\&.
  2193. .IP "\fB\f(CWip\-recvopts\fP\fP"
  2194. Sets the IP_RECVOPTS socket option\&. This enables receiving and logging of IP
  2195. options ancillary messages (Linux, *BSD)\&.
  2196. .IP "\fB\f(CWip\-recvtos\fP\fP"
  2197. Sets the IP_RECVTOS socket option\&. This enables receiving and logging of TOS
  2198. (type of service) ancillary messages (Linux)\&.
  2199. .IP "\fB\f(CWip\-recvttl\fP\fP"
  2200. Sets the IP_RECVTTL socket option\&. This enables receiving and logging of TTL
  2201. (time to live) ancillary messages (Linux, *BSD)\&.
  2202. .IP "\fB\f(CWip\-recvdstaddr\fP\fP"
  2203. Sets the IP_RECVDSTADDR socket option\&. This enables receiving and logging of
  2204. ancillary messages containing destination address (*BSD)
  2205. (example)\&.
  2206. .IP "\fB\f(CWip\-recvif\fP\fP"
  2207. Sets the IP_RECVIF socket option\&. This enables receiving and logging of
  2208. interface ancillary messages (*BSD) (example)\&.
  2209. .IP "\fB\f(CWip\-add\-membership=<multicast\-address:interface\-address>\fP\fP"
  2210. .IP "\fB\f(CWip\-add\-membership=<multicast\-address:interface\-name>\fP\fP"
  2211. .IP "\fB\f(CWip\-add\-membership=<multicast\-address:interface\-index>\fP\fP"
  2212. .IP "\fB\f(CWip\-add\-membership=<multicast\-address:interface\-address:interface\-name>\fP\fP"
  2213. .IP "\fB\f(CWip\-add\-membership=<multicast\-address:interface\-address:interface\-index>\fP\fP"
  2214. Makes the socket member of the specified multicast group\&. This is currently
  2215. only implemented for IPv4\&. The option takes the IP address of the multicast
  2216. group and info about the desired network interface\&. The most common syntax
  2217. is the first one, while the others are only available on systems that
  2218. provide \f(CWstruct mreqn\fP (Linux)\&.
  2219. .br
  2220. The indices of active network interfaces can be shown using the utility
  2221. \fBprocan\fP\&.
  2222. .IP "\fB\f(CWip\-multicast\-if=<hostname>\fP\fP"
  2223. Specifies hostname or address of the network interface to be used for
  2224. multicast traffic\&.
  2225. .IP "\fB\f(CWip\-multicast\-loop=<bool>\fP\fP"
  2226. Specifies if outgoing multicast traffic should loop back to the interface\&.
  2227. .IP "\fB\f(CWip\-multicast\-ttl=<byte>\fP\fP"
  2228. Sets the TTL used for outgoing multicast traffic\&. Default is 1\&.
  2229. .IP "\fB\f(CWres\-debug\fP\fP"
  2230. .IP "\fB\f(CWres\-aaonly\fP\fP"
  2231. .IP "\fB\f(CWres\-usevc\fP\fP"
  2232. .IP "\fB\f(CWres\-primary\fP\fP"
  2233. .IP "\fB\f(CWres\-igntc\fP\fP"
  2234. .IP "\fB\f(CWres\-recurse\fP\fP"
  2235. .IP "\fB\f(CWres\-defnames\fP\fP"
  2236. .IP "\fB\f(CWres\-stayopen\fP\fP"
  2237. .IP "\fB\f(CWres\-dnsrch\fP\fP"
  2238. These options set the corresponding resolver (name resolution) option flags\&.
  2239. Append \(dq\&=0\(dq\& to clear a default option\&. See man resolver\e(5) for more
  2240. information on these options\&. Note: these options are valid only for the
  2241. address they are applied to\&.
  2242. .IP
  2243. .br
  2244. .PP
  2245. \fI\fBIP6 option group\fP\fP
  2246. .PP
  2247. These options can only be used on IPv6 based sockets\&. See IP
  2248. options for options that can be applied to both IPv4 and IPv6
  2249. sockets\&.
  2250. .IP "\fB\f(CWipv6only=<bool>\fP\fP"
  2251. Sets the IPV6_V6ONLY socket option\&. If 0, the TCP stack will also accept
  2252. connections using IPv4 protocol on the same port\&. The default is system
  2253. dependent\&.
  2254. .IP "\fB\f(CWipv6\-recvdstopts\fP\fP"
  2255. Sets the IPV6_RECVDSTOPTS socket option\&. This enables receiving and logging
  2256. of ancillary messages containing the destination options\&.
  2257. .IP "\fB\f(CWipv6\-recvhoplimit\fP\fP"
  2258. Sets the IPV6_RECVHOPLIMIT socket option\&. This enables receiving and logging
  2259. of ancillary messages containing the hoplimit\&.
  2260. .IP "\fB\f(CWipv6\-recvhopopts\fP\fP"
  2261. Sets the IPV6_RECVHOPOPTS socket option\&. This enables receiving and logging
  2262. of ancillary messages containing the hop options\&.
  2263. .IP "\fB\f(CWipv6\-recvpktinfo\fP\fP"
  2264. Sets the IPV6_RECVPKTINFO socket option\&. This enables receiving and logging
  2265. of ancillary messages containing destination address and interface\&.
  2266. .IP "\fB\f(CWipv6\-unicast\-hops=link(TYPE_INT)(<int>)\fP\fP"
  2267. Sets the IPV6_UNICAST_HOPS socket option\&. This sets the hop count limit
  2268. (TTL) for outgoing unicast packets\&.
  2269. .IP "\fB\f(CWipv6\-recvrthdr\fP\fP"
  2270. Sets the IPV6_RECVRTHDR socket option\&. This enables receiving and logging
  2271. of ancillary messages containing routing information\&.
  2272. .IP "\fB\f(CWipv6\-tclass\fP\fP"
  2273. Sets the IPV6_TCLASS socket option\&. This sets the transfer class of outgoing
  2274. packets\&.
  2275. .IP "\fB\f(CWipv6\-recvtclass\fP\fP"
  2276. Sets the IPV6_RECVTCLASS socket option\&. This enables receiving and logging
  2277. of ancillary messages containing the transfer class\&.
  2278. .PP
  2279. .br
  2280. .PP
  2281. \fI\fBTCP option group\fP\fP
  2282. .PP
  2283. These options may be applied to TCP sockets\&. They work by invoking
  2284. \f(CWsetsockopt()\fP
  2285. with the appropriate parameters\&.
  2286. .IP "\fB\f(CWcork\fP\fP"
  2287. Doesn\(cq\&t send packets smaller than MSS (maximal segment size)\&.
  2288. .IP "\fB\f(CWdefer\-accept\fP\fP"
  2289. While listening, accepts connections only when data from the peer arrived\&.
  2290. .IP "\fB\f(CWkeepcnt=<count>\fP\fP"
  2291. Sets the number of keepalives before shutting down the socket to
  2292. <count> [int]\&.
  2293. .IP "\fB\f(CWkeepidle=<seconds>\fP\fP"
  2294. Sets the idle time before sending the first keepalive to <seconds>
  2295. [int]\&.
  2296. .IP "\fB\f(CWkeepintvl=<seconds>\fP\fP"
  2297. Sets the interval between two keepalives to <seconds>
  2298. [int]\&.
  2299. .IP "\fB\f(CWlinger2=<seconds>\fP\fP"
  2300. Sets the time to keep the socket in FIN\-WAIT\-2 state to <seconds>
  2301. [int]\&.
  2302. .IP "\fB\f(CWmss=<bytes>\fP\fP"
  2303. Sets the MSS (maximum segment size) after the
  2304. \f(CWsocket()\fP
  2305. call to <bytes>
  2306. [int]\&. This
  2307. value is then proposed to the peer with the SYN or SYN/ACK packet
  2308. (example)\&.
  2309. .IP "\fB\f(CWmss\-late=<bytes>\fP\fP"
  2310. Sets the MSS of the socket after connection has been established to <bytes>
  2311. [int]\&.
  2312. .IP "\fB\f(CWnodelay\fP\fP"
  2313. Turns off the Nagle algorithm for measuring the RTT (round trip time)\&.
  2314. .IP "\fB\f(CWrfc1323\fP\fP"
  2315. Enables RFC1323 TCP options: TCP window scale, round\-trip time measurement
  2316. (RTTM), and protect against wrapped sequence numbers (PAWS) (AIX)\&.
  2317. .IP "\fB\f(CWstdurg\fP\fP"
  2318. Enables RFC1122 compliant urgent pointer handling (AIX)\&.
  2319. .IP "\fB\f(CWsyncnt=<count>\fP\fP"
  2320. Sets the maximal number of SYN retransmits during connect to <count>
  2321. [int]\&.
  2322. .IP "\fB\f(CWmd5sig\fP\fP"
  2323. Enables generation of MD5 digests on the packets (FreeBSD)\&.
  2324. .IP "\fB\f(CWnoopt\fP\fP"
  2325. Disables use of TCP options (FreeBSD, MacOSX)\&.
  2326. .IP "\fB\f(CWnopush\fP\fP"
  2327. sets the TCP_NOPUSH socket option (FreeBSD, MacOSX)\&.
  2328. .IP "\fB\f(CWsack\-disable\fP\fP"
  2329. Disables use the selective acknowledge feature (OpenBSD)\&.
  2330. .IP "\fB\f(CWsignature\-enable\fP\fP"
  2331. Enables generation of MD5 digests on the packets (OpenBSD)\&.
  2332. .IP "\fB\f(CWabort\-threshold=<milliseconds>\fP\fP"
  2333. Sets the time to wait for an answer of the peer on an established connection
  2334. (HP\-UX)\&.
  2335. .IP "\fB\f(CWconn\-abort\-threshold=<milliseconds>\fP\fP"
  2336. Sets the time to wait for an answer of the server during the initial connect
  2337. (HP\-UX)\&.
  2338. .IP "\fB\f(CWkeepinit\fP\fP"
  2339. Sets the time to wait for an answer of the server during connect\e() before
  2340. giving up\&. Value in half seconds, default is 150 (75s) (Tru64)\&.
  2341. .IP "\fB\f(CWpaws\fP\fP"
  2342. Enables the \(dq\&protect against wrapped sequence numbers\(dq\& feature (Tru64)\&.
  2343. .IP "\fB\f(CWsackena\fP\fP"
  2344. Enables selective acknowledge (Tru64)\&.
  2345. .IP "\fB\f(CWtsoptena\fP\fP"
  2346. Enables the time stamp option that allows RTT recalculation on existing
  2347. connections (Tru64)\&.
  2348. .PP
  2349. .br
  2350. .PP
  2351. \fI\fBSCTP option group\fP\fP
  2352. .PP
  2353. These options may be applied to SCTP stream sockets\&.
  2354. .IP "\fB\f(CWsctp\-nodelay\fP\fP"
  2355. Sets the SCTP_NODELAY socket option that disables the Nagle algorithm\&.
  2356. .IP "\fB\f(CWsctp\-maxseg=<bytes>\fP\fP"
  2357. Sets the SCTP_MAXSEG socket option to <bytes> [int]\&. This
  2358. value is then proposed to the peer with the SYN or SYN/ACK packet\&.
  2359. .PP
  2360. .br
  2361. .PP
  2362. \fI\fBUDP, TCP, and SCTP option groups\fP\fP
  2363. .PP
  2364. Here we find options that are related to the network port mechanism and thus
  2365. can be used with UDP, TCP, and SCTP client and server addresses\&.
  2366. .IP "\fB\f(CWsourceport=<port>\fP\fP"
  2367. For outgoing (client) TCP and UDP connections, it sets the source
  2368. <port> using an extra
  2369. \f(CWbind()\fP
  2370. call\&.
  2371. With TCP or UDP listen addresses, socat immediately shuts down the
  2372. connection if the client does not use this sourceport (example)\&.
  2373. .IP "\fB\f(CWlowport\fP\fP"
  2374. Outgoing (client) TCP and UDP connections with this option use
  2375. an unused random source port between 640 and 1023 incl\&. On UNIX class operating
  2376. systems, this requires root privilege, and thus indicates that the
  2377. client process is authorized by local root\&.
  2378. TCP and UDP listen addresses with this option immediately shut down the
  2379. connection if the client does not use a sourceport <= 1023\&.
  2380. This mechanism can provide limited authorization under some circumstances\&.
  2381. .PP
  2382. .br
  2383. .PP
  2384. \fI\fBSOCKS option group\fP\fP
  2385. .PP
  2386. When using SOCKS type addresses, some socks specific options can be set\&.
  2387. .IP "\fB\f(CWsocksport=<tcp service>\fP\fP"
  2388. Overrides the default \(dq\&socks\(dq\& service or port 1080 for the socks server
  2389. port with <TCP service>\&.
  2390. .IP "\fB\f(CWsocksuser=<user>\fP\fP"
  2391. Sends the <user> [string] in the username field to the
  2392. socks server\&. Default is the actual user name ($LOGNAME or $USER) (example)\&.
  2393. .PP
  2394. .br
  2395. .PP
  2396. \fI\fBHTTP option group\fP\fP
  2397. .PP
  2398. Options that can be provided with HTTP type addresses\&. The only HTTP address
  2399. currently implemented is proxy\-connect\&.
  2400. .PP
  2401. .IP "\fB\f(CWproxyport=<TCP service>\fP\fP"
  2402. Overrides the default HTTP proxy port 8080 with
  2403. <TCP service>\&.
  2404. .IP "\fB\f(CWignorecr\fP\fP"
  2405. The HTTP protocol requires the use of CR+NL as line terminator\&. When a proxy
  2406. server violates this standard, socat might not understand its answer\&.
  2407. This option directs socat to interprete NL as line terminator and
  2408. to ignore CR in the answer\&. Nevertheless, socat sends CR+NL to the proxy\&.
  2409. .IP "\fB\f(CWproxyauth=<username>:<password>\fP\fP"
  2410. Provide \(dq\&basic\(dq\& authentication to the proxy server\&. The argument to the
  2411. option is used with a \(dq\&Proxy\-Authorization: Base\(dq\& header in base64 encoded
  2412. form\&.
  2413. .br
  2414. Note: username and password are visible for every user on the local machine
  2415. in the process list; username and password are transferred to the proxy
  2416. server unencrypted (base64 encoded) and might be sniffed\&.
  2417. .IP "\fB\f(CWresolve\fP\fP"
  2418. Per default, socat sends to the proxy a CONNECT request containing the
  2419. target hostname\&. With this option, socat resolves the hostname locally and
  2420. sends the IP address\&. Please note that, according to RFC 2396, only name
  2421. resolution to IPv4 addresses is implemented\&.
  2422. .PP
  2423. .br
  2424. .PP
  2425. \fI\fBRANGE option group\fP\fP
  2426. .PP
  2427. These options check if a connecting client should be granted access\&. They can
  2428. be applied to listening and receiving network sockets\&. tcp\-wrappers options
  2429. fall into this group\&.
  2430. .IP "\fB\f(CWrange=<address\-range>\fP\fP"
  2431. After accepting a connection, tests if the peer is within \fIrange\fP\&. For
  2432. IPv4 addresses, address\-range takes the form address/bits, e\&.g\&.
  2433. 10\&.0\&.0\&.0/8, or address:mask, e\&.g\&. 10\&.0\&.0\&.0:255\&.0\&.0\&.0 (example); for IPv6, it is [ip6\-address/bits], e\&.g\&. [::1/128]\&.
  2434. If the client address does not match, \fBsocat\fP issues a warning and keeps
  2435. listening/receiving\&.
  2436. .IP "\fB\f(CWtcpwrap[=<name>]\fP\fP"
  2437. Uses Wietse Venema\(cq\&s libwrap (tcpd) library to determine
  2438. if the client is allowed to connect\&. The configuration files are
  2439. /etc/hosts\&.allow and /etc/hosts\&.deny per default, see \(dq\&man 5 hosts_access\(dq\&
  2440. for more information\&. The optional <name> (type string)
  2441. is passed to the wrapper functions as daemon process name (example)\&.
  2442. If omitted, the basename of socats invocation (argv[0]) is passed\&.
  2443. If both tcpwrap and range options are applied to an address, both
  2444. conditions must be fulfilled to allow the connection\&.
  2445. .IP "\fB\f(CWallow\-table=<filename>\fP\fP"
  2446. Takes the specified file instead of /etc/hosts\&.allow\&.
  2447. .IP "\fB\f(CWdeny\-table=<filename>\fP\fP"
  2448. Takes the specified file instead of /etc/hosts\&.deny\&.
  2449. .IP "\fB\f(CWtcpwrap\-etc=<directoryname>\fP\fP"
  2450. Looks for hosts\&.allow and hosts\&.deny in the specified directory\&. Is
  2451. overridden by options hosts\-allow
  2452. and hosts\-deny\&.
  2453. .PP
  2454. .br
  2455. .PP
  2456. \fI\fBLISTEN option group\fP\fP
  2457. .PP
  2458. Options specific to listening sockets\&.
  2459. .IP "\fB\f(CWbacklog=<count>\fP\fP"
  2460. Sets the backlog value passed with the
  2461. \f(CWlisten()\fP
  2462. system call to <count>
  2463. [int]\&. Default is 5\&.
  2464. .IP "\fB\f(CWmax\-children=<count>\fP\fP"
  2465. Limits the number of concurrent child processes [int]\&.
  2466. Default is no limit\&.
  2467. .br
  2468. .PP
  2469. \fI\fBCHILD option group\fP\fP
  2470. .PP
  2471. Options for addresses with multiple connections via child processes\&.
  2472. .IP "\fB\f(CWfork\fP\fP"
  2473. After establishing a connection, handles its channel in a child process and
  2474. keeps the parent process attempting to produce more connections, either by
  2475. listening or by connecting in a loop (example)\&.
  2476. .br
  2477. SSL\-CONNECT and SSL\-LISTEN differ in when they actually fork off the child:
  2478. SSL\-LISTEN forks \fIbefore\fP the SSL handshake, while SSL\-CONNECT forks
  2479. \fIafterwards\fP\&.
  2480. RETRY and FOREVER options are not inherited by the child process\&.
  2481. .br
  2482. On some operating systems (e\&.g\&. FreeBSD) this option does not work for
  2483. UDP\-LISTEN addresses\&.
  2484. .br
  2485. .PP
  2486. .br
  2487. .PP
  2488. \fI\fBEXEC option group\fP\fP
  2489. .PP
  2490. Options for addresses that invoke a program\&.
  2491. .IP "\fB\f(CWpath=<string>\fP\fP"
  2492. Overrides the PATH environment variable for searching the program with
  2493. <string>\&. This
  2494. \f(CW$PATH\fP
  2495. value is effective in the child process too\&.
  2496. .IP "\fB\f(CWlogin\fP\fP"
  2497. Prefixes
  2498. \f(CWargv[0]\fP
  2499. for the
  2500. \f(CWexecvp()\fP
  2501. call with \(cq\&\-\(cq\&, thus making a
  2502. shell behave as login shell\&.
  2503. .PP
  2504. .br
  2505. .PP
  2506. \fI\fBFORK option group\fP\fP
  2507. .PP
  2508. EXEC or SYSTEM addresses invoke a program using a child process and transfer data between \fBsocat\fP and the program\&. The interprocess communication mechanism can be influenced with the following options\&. Per
  2509. default, a
  2510. \f(CWsocketpair()\fP
  2511. is created and assigned to stdin and stdout of
  2512. the child process, while stderr is inherited from the \fBsocat\fP process, and the
  2513. child process uses file descriptors 0 and 1 for communicating with the main
  2514. socat process\&.
  2515. .IP "\fB\f(CWnofork\fP\fP"
  2516. Does not fork a subprocess for executing the program, instead calls execvp\e()
  2517. or system\e() directly from the actual socat instance\&. This avoids the
  2518. overhead of another process between the program and its peer,
  2519. but introduces a lot of restrictions:
  2520. .IP o
  2521. this option can only be applied to the second \fBsocat\fP address\&.
  2522. .IP o
  2523. it cannot be applied to a part of a dual address\&.
  2524. .IP o
  2525. the first socat address cannot be OPENSSL or READLINE
  2526. .IP o
  2527. socat options \-b, \-t, \-D, \-l, \-v, \-x become useless
  2528. .IP o
  2529. for both addresses, options ignoreeof, cr, and crnl become useless
  2530. .IP o
  2531. for the second address (the one with option nofork), options
  2532. append, cloexec, flock, user, group, mode, nonblock,
  2533. perm\-late, setlk, and setpgid cannot be applied\&. Some of these could be
  2534. used on the first address though\&.
  2535. .IP "\fB\f(CWpipes\fP\fP"
  2536. Creates a pair of unnamed pipes for interprocess communication instead of a
  2537. socket pair\&.
  2538. .IP "\fB\f(CWopenpty\fP\fP"
  2539. Establishes communication with the sub process using a pseudo terminal
  2540. created with
  2541. \f(CWopenpty()\fP
  2542. instead of the default (socketpair or ptmx)\&.
  2543. .IP "\fB\f(CWptmx\fP\fP"
  2544. Establishes communication with the sub process using a pseudo terminal
  2545. created by opening \fB/dev/ptmx\fP or \fB/dev/ptc\fP instead of the default
  2546. (socketpair)\&.
  2547. .IP "\fB\f(CWpty\fP\fP"
  2548. Establishes communication with the sub process using a pseudo terminal
  2549. instead of a socket pair\&. Creates the pty with an available mechanism\&. If
  2550. openpty and ptmx are both available, it uses ptmx because this is POSIX
  2551. compliant (example)\&.
  2552. .IP "\fB\f(CWctty\fP\fP"
  2553. Makes the pty the controlling tty of the sub process (example)\&.
  2554. .IP "\fB\f(CWstderr\fP\fP"
  2555. Directs stderr of the sub process to its output channel by making stderr a
  2556. \f(CWdup()\fP
  2557. of stdout (example)\&.
  2558. .IP "\fB\f(CWfdin=<fdnum>\fP\fP"
  2559. Assigns the sub processes input channel to its file descriptor
  2560. <fdnum>
  2561. instead of stdin (0)\&. The program started from the subprocess has to use
  2562. this fd for reading data from \fBsocat\fP (example)\&.
  2563. .IP "\fB\f(CWfdout=<fdnum>\fP\fP"
  2564. Assigns the sub processes output channel to its file descriptor
  2565. <fdnum>
  2566. instead of stdout (1)\&. The program started from the subprocess has to use
  2567. this fd for writing data to \fBsocat\fP (example)\&.
  2568. .IP "\fB\f(CWsighup\fP\fP, \fB\f(CWsigint\fP\fP, \fB\f(CWsigquit\fP\fP"
  2569. Has \fBsocat\fP pass signals of this type to the sub process\&.
  2570. If no address has this option, socat terminates on these signals\&.
  2571. .PP
  2572. .br
  2573. .PP
  2574. \fI\fBTERMIOS option group\fP\fP
  2575. .PP
  2576. For addresses that work on a tty (e\&.g\&., stdio, file:/dev/tty, exec:\&.\&.\&.,pty), the terminal parameters defined in the UN*X termios mechanism are made available as address option parameters\&.
  2577. Please note that changes of the parameters of your interactive terminal
  2578. remain effective after \fBsocat\fP\(cq\&s termination, so you might have to enter \(dq\&reset\(dq\&
  2579. or \(dq\&stty sane\(dq\& in your shell afterwards\&.
  2580. For EXEC and SYSTEM addresses with option PTY,
  2581. these options apply to the pty by the child processes\&.
  2582. .PP
  2583. .IP "\fB\f(CWb0\fP\fP"
  2584. Disconnects the terminal\&.
  2585. .IP "\fB\f(CWb19200\fP\fP"
  2586. Sets the serial line speed to 19200 baud\&. Some other rates are possible; use
  2587. something like \f(CWsocat \-hh |grep \(cq\& b[1\-9]\(cq\&\fP to find all speeds supported by
  2588. your implementation\&.
  2589. .br
  2590. Note: On some operating systems, these options may not be
  2591. available\&. Use ispeed or ospeed
  2592. instead\&.
  2593. .IP "\fB\f(CWecho=<bool>\fP\fP"
  2594. Enables or disables local echo (example)\&.
  2595. .IP "\fB\f(CWicanon=<bool>\fP\fP"
  2596. Sets or clears canonical mode, enabling line buffering and some special
  2597. characters\&.
  2598. .IP "\fB\f(CWraw\fP\fP"
  2599. Sets raw mode, thus passing input and output almost unprocessed (example)\&.
  2600. .IP "\fB\f(CWignbrk=<bool>\fP\fP"
  2601. Ignores or interpretes the BREAK character (e\&.g\&., ^C)
  2602. .IP "\fB\f(CWbrkint=<bool>\fP\fP"
  2603. .IP "\fB\f(CWbs0\fP\fP"
  2604. .IP "\fB\f(CWbs1\fP\fP"
  2605. .IP "\fB\f(CWbsdly=<0|1>\fP\fP"
  2606. .IP "\fB\f(CWclocal=<bool>\fP\fP"
  2607. .IP
  2608. \.LP
  2609. \.nf
  2610. \fBcr0
  2611. cr1
  2612. cr2
  2613. cr3\fP
  2614. \.fi
  2615. \.IP
  2616. Sets the carriage return delay to 0, 1, 2, or 3, respectively\&.
  2617. 0 means no delay, the other values are terminal dependent\&.
  2618. .IP
  2619. .IP "\fB\f(CWcrdly=<0|1|2|3>\fP\fP"
  2620. .IP "\fB\f(CWcread=<bool>\fP\fP"
  2621. .IP "\fB\f(CWcrtscts=<bool>\fP\fP"
  2622. .IP
  2623. \.LP
  2624. \.nf
  2625. \fBcs5
  2626. cs6
  2627. cs7
  2628. cs8\fP
  2629. \.fi
  2630. \.IP
  2631. Sets the character size to 5, 6, 7, or 8 bits, respectively\&.
  2632. .IP
  2633. .IP "\fB\f(CWcsize=<0|1|2|3>\fP\fP"
  2634. .IP "\fB\f(CWcstopb=<bool>\fP\fP"
  2635. Sets two stop bits, rather than one\&.
  2636. .IP "\fB\f(CWdsusp=<byte>\fP\fP"
  2637. Sets the value for the VDSUSP character that suspends the current foreground
  2638. process and reactivates the shell (all except Linux)\&.
  2639. .IP "\fB\f(CWechoctl=<bool>\fP\fP"
  2640. Echos control characters in hat notation (e\&.g\&. ^A)
  2641. .IP "\fB\f(CWechoe=<bool>\fP\fP"
  2642. .IP "\fB\f(CWechok=<bool>\fP\fP"
  2643. .IP "\fB\f(CWechoke=<bool>\fP\fP"
  2644. .IP "\fB\f(CWechonl=<bool>\fP\fP"
  2645. .IP "\fB\f(CWechoprt=<bool>\fP\fP"
  2646. .IP "\fB\f(CWeof=<byte>\fP\fP"
  2647. .IP "\fB\f(CWeol=<byte>\fP\fP"
  2648. .IP "\fB\f(CWeol2=<byte>\fP\fP"
  2649. .IP "\fB\f(CWerase=<byte>\fP\fP"
  2650. .IP "\fB\f(CWdiscard=<byte>\fP\fP"
  2651. .IP "\fB\f(CWff0\fP\fP"
  2652. .IP "\fB\f(CWff1\fP\fP"
  2653. .IP "\fB\f(CWffdly=<bool>\fP\fP"
  2654. .IP "\fB\f(CWflusho=<bool>\fP\fP"
  2655. .IP "\fB\f(CWhupcl=<bool>\fP\fP"
  2656. .IP "\fB\f(CWicrnl=<bool>\fP\fP"
  2657. .IP "\fB\f(CWiexten=<bool>\fP\fP"
  2658. .IP "\fB\f(CWigncr=<bool>\fP\fP"
  2659. .IP "\fB\f(CWignpar=<bool>\fP\fP"
  2660. .IP "\fB\f(CWimaxbel=<bool>\fP\fP"
  2661. .IP "\fB\f(CWinlcr=<bool>\fP\fP"
  2662. .IP "\fB\f(CWinpck=<bool>\fP\fP"
  2663. .IP "\fB\f(CWintr=<byte>\fP\fP"
  2664. .IP "\fB\f(CWisig=<bool>\fP\fP"
  2665. .IP "\fB\f(CWispeed=<unsigned\-int>\fP\fP"
  2666. Set the baud rate for incoming data on this line\&.
  2667. .br
  2668. See also: ospeed, b19200
  2669. .IP "\fB\f(CWistrip=<bool>\fP\fP"
  2670. .IP "\fB\f(CWiuclc=<bool>\fP\fP"
  2671. .IP "\fB\f(CWixany=<bool>\fP\fP"
  2672. .IP "\fB\f(CWixoff=<bool>\fP\fP"
  2673. .IP "\fB\f(CWixon=<bool>\fP\fP"
  2674. .IP "\fB\f(CWkill=<byte>\fP\fP"
  2675. .IP "\fB\f(CWlnext=<byte>\fP\fP"
  2676. .IP "\fB\f(CWmin=<byte>\fP\fP"
  2677. .IP "\fB\f(CWnl0\fP\fP"
  2678. Sets the newline delay to 0\&.
  2679. .IP "\fB\f(CWnl1\fP\fP"
  2680. .IP "\fB\f(CWnldly=<bool>\fP\fP"
  2681. .IP "\fB\f(CWnoflsh=<bool>\fP\fP"
  2682. .IP "\fB\f(CWocrnl=<bool>\fP\fP"
  2683. .IP "\fB\f(CWofdel=<bool>\fP\fP"
  2684. .IP "\fB\f(CWofill=<bool>\fP\fP"
  2685. .IP "\fB\f(CWolcuc=<bool>\fP\fP"
  2686. .IP "\fB\f(CWonlcr=<bool>\fP\fP"
  2687. .IP "\fB\f(CWonlret=<bool>\fP\fP"
  2688. .IP "\fB\f(CWonocr=<bool>\fP\fP"
  2689. .IP "\fB\f(CWopost=<bool>\fP\fP"
  2690. Enables or disables output processing; e\&.g\&., converts NL to CR\-NL\&.
  2691. .IP "\fB\f(CWospeed=<unsigned\-int>\fP\fP"
  2692. Set the baud rate for outgoing data on this line\&.
  2693. .br
  2694. See also: ispeed, b19200
  2695. .IP "\fB\f(CWparenb=<bool>\fP\fP"
  2696. Enable parity generation on output and parity checking for input\&.
  2697. .IP "\fB\f(CWparmrk=<bool>\fP\fP"
  2698. .IP "\fB\f(CWparodd=<bool>\fP\fP"
  2699. .IP "\fB\f(CWpendin=<bool>\fP\fP"
  2700. .IP "\fB\f(CWquit=<byte>\fP\fP"
  2701. .IP "\fB\f(CWreprint=<byte>\fP\fP"
  2702. .IP "\fB\f(CWsane\fP\fP"
  2703. Brings the terminal to something like a useful default state\&.
  2704. .IP "\fB\f(CWstart=<byte>\fP\fP"
  2705. .IP "\fB\f(CWstop=<byte>\fP\fP"
  2706. .IP "\fB\f(CWsusp=<byte>\fP\fP"
  2707. .IP "\fB\f(CWswtc=<byte>\fP\fP"
  2708. .IP "\fB\f(CWtab0\fP\fP"
  2709. .IP "\fB\f(CWtab1\fP\fP"
  2710. .IP "\fB\f(CWtab2\fP\fP"
  2711. .IP "\fB\f(CWtab3\fP\fP"
  2712. .IP "\fB\f(CWtabdly=<unsigned\-int>\fP\fP"
  2713. .IP "\fB\f(CWtime=<byte>\fP\fP"
  2714. .IP "\fB\f(CWtostop=<bool>\fP\fP"
  2715. .IP "\fB\f(CWvt0\fP\fP"
  2716. .IP "\fB\f(CWvt1\fP\fP"
  2717. .IP "\fB\f(CWvtdly=<bool>\fP\fP"
  2718. .IP "\fB\f(CWwerase=<byte>\fP\fP"
  2719. .IP "\fB\f(CWxcase=<bool>\fP\fP"
  2720. .IP "\fB\f(CWxtabs\fP\fP"
  2721. .IP "\fB\f(CWi\-pop\-all\fP\fP"
  2722. With UNIX System V STREAMS, removes all drivers from the stack\&.
  2723. .IP "\fB\f(CWi\-push=<string>\fP\fP"
  2724. With UNIX System V STREAMS, pushes the driver (module) with the given name
  2725. (string) onto the stack\&. For example, to make sure that a
  2726. character device on Solaris supports termios etc, use the following options:
  2727. \f(CWi\-pop\-all,i\-push=ptem,i\-push=ldterm,i\-push=ttcompat\fP
  2728. .PP
  2729. .br
  2730. .PP
  2731. \fI\fBPTY option group\fP\fP
  2732. .PP
  2733. These options are intended for use with the pty address
  2734. type\&.
  2735. .PP
  2736. .IP "\fB\f(CWlink=<filename>\fP\fP"
  2737. Generates a symbolic link that points to the actual pseudo terminal
  2738. (pty)\&. This might help
  2739. to solve the problem that ptys are generated with more or less
  2740. unpredictable names, making it difficult to directly access the socat
  2741. generated pty automatically\&. With this option, the user can specify a \(dq\&fix\(dq\&
  2742. point in the file hierarchy that helps him to access the actual pty
  2743. (example)\&.
  2744. Beginning with \fBsocat\fP version 1\&.4\&.3, the symbolic link is removed when
  2745. the address is closed (but see option unlink\-close)\&.
  2746. .IP "\fB\f(CWwait\-slave\fP\fP"
  2747. Blocks the open phase until a process opens the slave side of the pty\&.
  2748. Usually, socat continues after generating the pty with opening the next
  2749. address or with entering the transfer loop\&. With the wait\-slave option,
  2750. socat waits until some process opens the slave side of the pty before
  2751. continuing\&.
  2752. This option only works if the operating system provides the \f(CWpoll()\fP
  2753. system call\&. And it depends on an undocumented behaviour of pty\(cq\&s, so it
  2754. does not work on all operating systems\&. It has successfully been tested on
  2755. Linux, FreeBSD, NetBSD, and on Tru64 with openpty\&.
  2756. .IP "\fB\f(CWpty\-interval=<seconds>\fP\fP"
  2757. When the wait\-slave option is set, socat
  2758. periodically checks the HUP condition using \f(CWpoll()\fP to find if the pty\(cq\&s
  2759. slave side has been opened\&. The default polling interval is 1s\&. Use the
  2760. pty\-interval option [timeval] to change this value\&.
  2761. .PP
  2762. .br
  2763. .PP
  2764. \fI\fBOPENSSL option group\fP\fP
  2765. .PP
  2766. These options apply to the openssl and
  2767. openssl\-listen address types\&.
  2768. .PP
  2769. .IP "\fB\f(CWcipher=<cipherlist>\fP\fP"
  2770. Selects the list of ciphers that may be used for the connection\&.
  2771. See the man page of
  2772. \f(CWciphers\fP
  2773. , section \fBCIPHER LIST FORMAT\fP, for
  2774. detailed information about syntax, values, and default of <cipherlist>\&.
  2775. .br
  2776. Several cipher strings may be given, separated by \(cq\&:\(cq\&\&.
  2777. Some simple cipher strings:
  2778. .IP "3DES"
  2779. Uses a cipher suite with triple DES\&.
  2780. .IP "MD5"
  2781. Uses a cipher suite with MD5\&.
  2782. .IP "aNULL"
  2783. Uses a cipher suite without authentication\&.
  2784. .IP "NULL"
  2785. Does not use encryption\&.
  2786. .IP "HIGH"
  2787. Uses a cipher suite with \(dq\&high\(dq\& encryption\&.
  2788. Note that the peer must support the selected property, or the negotiation
  2789. will fail\&.
  2790. .IP "\fB\f(CWmethod=<ssl\-method>\fP\fP"
  2791. Sets the protocol version to be used\&. Valid strings (not case sensitive)
  2792. are:
  2793. .IP "\f(CWSSLv2\fP"
  2794. Select SSL protocol version 2\&.
  2795. .IP "\f(CWSSLv3\fP"
  2796. Select SSL protocol version 3\&.
  2797. .IP "\f(CWSSLv23\fP"
  2798. Select SSL protocol version 2 or 3\&. This is the default when
  2799. this option is not provided\&.
  2800. .IP "\f(CWTLSv1\fP"
  2801. Select TLS protocol version 1\&.
  2802. .IP "\fB\f(CWverify=<bool>\fP\fP"
  2803. Controls check of the peer\(cq\&s certificate\&. Default is 1 (true)\&. Disabling
  2804. verify might open your socket for everyone, making the encryption useless!
  2805. .IP "\fB\f(CWcert=<filename>\fP\fP"
  2806. Specifies the file with the certificate and private key for authentication\&.
  2807. The certificate must be in OpenSSL format (*\&.pem)\&.
  2808. With openssl\-listen, use of this option is strongly
  2809. recommended\&. Except with cipher aNULL, \(dq\&no shared ciphers\(dq\& error will
  2810. occur when no certificate is given\&.
  2811. .IP "\fB\f(CWkey=<filename>\fP\fP"
  2812. Specifies the file with the private key\&. The private key may be in this
  2813. file or in the file given with the cert option\&. The party that has
  2814. to proof that it is the owner of a certificate needs the private key\&.
  2815. .IP "\fB\f(CWdhparams=<filename>\fP\fP"
  2816. Specifies the file with the Diffie Hellman parameters\&. These parameters may
  2817. also be in the file given with the cert
  2818. option in which case the dhparams option is not needed\&.
  2819. .IP "\fB\f(CWcafile=<filename>\fP\fP"
  2820. Specifies the file with the trusted (root) authority certificates\&. The file
  2821. must be in PEM format and should contain one or more certificates\&. The party
  2822. that checks the authentication of its peer trusts only certificates that are
  2823. in this file\&.
  2824. .IP "\fB\f(CWcapath=<dirname>\fP\fP"
  2825. Specifies the directory with the trusted (root) certificates\&. The directory
  2826. must contain certificates in PEM format and their hashes (see OpenSSL
  2827. documentation)
  2828. .IP "\fB\f(CWegd=<filename>\fP\fP"
  2829. On some systems, openssl requires an explicit source of random data\&. Specify
  2830. the socket name where an entropy gathering daemon like egd provides random
  2831. data, e\&.g\&. /dev/egd\-pool\&.
  2832. .IP "\fB\f(CWpseudo\fP\fP"
  2833. On systems where openssl cannot find an entropy source and where no entropy
  2834. gathering daemon can be utilized, this option activates a mechanism for
  2835. providing pseudo entropy\&. This is archieved by taking the current time in
  2836. microseconds for feeding the libc pseudo random number generator with an
  2837. initial value\&. openssl is then feeded with output from random\e() calls\&.
  2838. .br
  2839. NOTE:This mechanism is not sufficient for generation of secure keys!
  2840. .IP "\fB\f(CWcompress\fP\fP"
  2841. Enable or disable the use of compression for a connection\&. Setting this to
  2842. \(dq\&none\(dq\& disables compression, setting it to \(dq\&auto\(dq\& lets OpenSSL choose the best
  2843. available algorithm supported by both parties\&. The default is to not touch any
  2844. compression\-related settings\&.
  2845. NOTE: Requires OpenSSL 0\&.9\&.8 or higher and disabling compression with
  2846. OpenSSL 0\&.9\&.8 affects all new connections in the process\&.
  2847. .IP "\fB\f(CWfips\fP\fP"
  2848. Enables FIPS mode if compiled in\&. For info about the FIPS encryption
  2849. implementation standard see http://oss\-institute\&.org/fips\-faq\&.html\&.
  2850. This mode might require that the involved certificates are generated with a
  2851. FIPS enabled version of openssl\&. Setting or clearing this option on one
  2852. socat address affects all OpenSSL addresses of this process\&.
  2853. .PP
  2854. .br
  2855. .PP
  2856. \fI\fBRETRY option group\fP\fP
  2857. .PP
  2858. Options that control retry of some system calls, especially connection
  2859. attempts\&.
  2860. .PP
  2861. .IP "\fB\f(CWretry=<num>\fP\fP"
  2862. Number of retries before the connection or listen attempt is aborted\&.
  2863. Default is 0, which means just one attempt\&.
  2864. .IP "\fB\f(CWinterval=<timespec>\fP\fP"
  2865. Time between consecutive attempts (seconds,
  2866. [timespec])\&. Default is 1 second\&.
  2867. .IP "\fB\f(CWforever\fP\fP"
  2868. Performs an unlimited number of retry attempts\&.
  2869. .PP
  2870. .br
  2871. .PP
  2872. \fI\fBTUN option group\fP\fP
  2873. .PP
  2874. Options that control Linux TUN/TAP interface device addresses\&.
  2875. .PP
  2876. .IP "\fB\f(CWtun\-device=<device\-file>\fP\fP"
  2877. Instructs socat to take another path for the TUN clone device\&. Default is
  2878. \f(CW/dev/net/tun\fP\&.
  2879. .IP "\fB\f(CWtun\-name=<if\-name>\fP\fP"
  2880. Gives the resulting network interface a specific name instead of the system
  2881. generated (tun0, tun1, etc\&.)
  2882. .IP "\fB\f(CWtun\-type=[tun|tap]\fP\fP"
  2883. Sets the type of the TUN device; use this option to generate a TAP
  2884. device\&. See the Linux docu for the difference between these types\&.
  2885. When you try to establish a tunnel between two TUN devices, their types
  2886. should be the same\&.
  2887. .IP "\fB\f(CWiff\-no\-pi\fP\fP"
  2888. Sets the IFF_NO_PI flag which controls if the device includes additional
  2889. packet information in the tunnel\&.
  2890. When you try to establish a tunnel between two TUN devices, these flags
  2891. should have the same values\&.
  2892. .IP "\fB\f(CWiff\-up\fP\fP"
  2893. Sets the TUN network interface status UP\&. Strongly recommended\&.
  2894. .IP "\fB\f(CWiff\-broadcast\fP\fP"
  2895. Sets the BROADCAST flag of the TUN network interface\&.
  2896. .IP "\fB\f(CWiff\-debug\fP\fP"
  2897. Sets the DEBUG flag of the TUN network interface\&.
  2898. .IP "\fB\f(CWiff\-loopback\fP\fP"
  2899. Sets the LOOPBACK flag of the TUN network interface\&.
  2900. .IP "\fB\f(CWiff\-pointopoint\fP\fP"
  2901. Sets the POINTOPOINT flag of the TUN device\&.
  2902. .IP "\fB\f(CWiff\-notrailers\fP\fP"
  2903. Sets the NOTRAILERS flag of the TUN device\&.
  2904. .IP "\fB\f(CWiff\-running\fP\fP"
  2905. Sets the RUNNING flag of the TUN device\&.
  2906. .IP "\fB\f(CWiff\-noarp\fP\fP"
  2907. Sets the NOARP flag of the TUN device\&.
  2908. .IP "\fB\f(CWiff\-promisc\fP\fP"
  2909. Sets the PROMISC flag of the TUN device\&.
  2910. .IP "\fB\f(CWiff\-allmulti\fP\fP"
  2911. Sets the ALLMULTI flag of the TUN device\&.
  2912. .IP "\fB\f(CWiff\-master\fP\fP"
  2913. Sets the MASTER flag of the TUN device\&.
  2914. .IP "\fB\f(CWiff\-slave\fP\fP"
  2915. Sets the SLAVE flag of the TUN device\&.
  2916. .IP "\fB\f(CWiff\-multicast\fP\fP"
  2917. Sets the MULTICAST flag of the TUN device\&.
  2918. .IP "\fB\f(CWiff\-portsel\fP\fP"
  2919. Sets the PORTSEL flag of the TUN device\&.
  2920. .IP "\fB\f(CWiff\-automedia\fP\fP"
  2921. Sets the AUTOMEDIA flag of the TUN device\&.
  2922. .IP "\fB\f(CWiff\-dynamic\fP\fP"
  2923. Sets the DYNAMIC flag of the TUN device\&.
  2924. .PP
  2925. .br
  2926. .PP
  2927. .SH "DATA VALUES"
  2928. .PP
  2929. This section explains the different data types that address parameters and
  2930. address options can take\&.
  2931. .PP
  2932. .IP "address\-range"
  2933. Is currently only implemented for IPv4 and IPv6\&. See address\-option
  2934. `range\(cq\&
  2935. .IP "bool"
  2936. \(dq\&0\(dq\& or \(dq\&1\(dq\&; if value is omitted, \(dq\&1\(dq\& is taken\&.
  2937. .IP "byte"
  2938. An unsigned int number, read with
  2939. \f(CWstrtoul()\fP
  2940. , lower or equal to
  2941. \f(CWUCHAR_MAX\fP
  2942. \&.
  2943. .IP "command\-line"
  2944. A string specifying a program name and its arguments, separated by single
  2945. spaces\&.
  2946. .IP "data"
  2947. A raw data specification following \fIdalan\fP syntax\&. Currently the only
  2948. valid form is a string starting with \(cq\&x\(cq\& followed by an even number of hex
  2949. digits, specifying a sequence of bytes\&.
  2950. .IP "directory"
  2951. A string with usual UN*X directory name semantics\&.
  2952. .IP "facility"
  2953. The name of a syslog facility in lower case characters\&.
  2954. .IP "fdnum"
  2955. An unsigned int type, read with
  2956. \f(CWstrtoul()\fP
  2957. , specifying a UN*X file
  2958. descriptor\&.
  2959. .IP "filename"
  2960. A string with usual UN*X filename semantics\&.
  2961. .IP "group"
  2962. If the first character is a decimal digit, the value is read with
  2963. \f(CWstrtoul()\fP
  2964. as unsigned integer specifying a group id\&. Otherwise, it
  2965. must be an existing group name\&.
  2966. .IP "int"
  2967. A number following the rules of the
  2968. \f(CWstrtol()\fP
  2969. function with base
  2970. \(dq\&0\(dq\&, i\&.e\&. decimal number, octal number with leading \(dq\&0\(dq\&, or hexadecimal
  2971. number with leading \(dq\&0x\(dq\&\&. The value must fit into a C int\&.
  2972. .IP "interface"
  2973. A string specifying the device name of a network interface
  2974. as shown by ifconfig or procan, e\&.g\&. \(dq\&eth0\(dq\&\&.
  2975. .IP "IP address"
  2976. An IPv4 address in numbers\-and\-dots notation, an IPv6 address in hex
  2977. notation enclosed in brackets, or a hostname that resolves to an IPv4 or an
  2978. IPv6 address\&.
  2979. .br
  2980. Examples: 127\&.0\&.0\&.1, [::1], www\&.dest\-unreach\&.org, dns1
  2981. .IP "IPv4 address"
  2982. An IPv4 address in numbers\-and\-dots notation or a hostname that resolves to
  2983. an IPv4 address\&.
  2984. .br
  2985. Examples: 127\&.0\&.0\&.1, www\&.dest\-unreach\&.org, dns2
  2986. .IP "IPv6 address"
  2987. An iPv6 address in hexnumbers\-and\-colons notation enclosed in brackets, or a
  2988. hostname that resolves to an IPv6 address\&.
  2989. .br
  2990. Examples: [::1], [1234:5678:9abc:def0:1234:5678:9abc:def0],
  2991. ip6name\&.domain\&.org
  2992. .IP "long"
  2993. A number read with
  2994. \f(CWstrtol()\fP
  2995. \&. The value must fit into a C long\&.
  2996. .IP "long long"
  2997. A number read with
  2998. \f(CWstrtoll()\fP
  2999. \&. The value must fit into a C long long\&.
  3000. .IP "off_t"
  3001. An implementation dependend signed number, usually 32 bits, read with strtol
  3002. or strtoll\&.
  3003. .IP "off64_t"
  3004. An implementation dependend signed number, usually 64 bits, read with strtol
  3005. or strtoll\&.
  3006. .IP "mode_t"
  3007. An unsigned integer, read with
  3008. \f(CWstrtoul()\fP
  3009. , specifying mode (permission)
  3010. bits\&.
  3011. .IP "pid_t"
  3012. A number, read with
  3013. \f(CWstrtol()\fP
  3014. , specifying a process id\&.
  3015. .IP "port"
  3016. A uint16_t (16 bit unsigned number) specifying a TCP or UDP port, read
  3017. with
  3018. \f(CWstrtoul()\fP
  3019. \&.
  3020. .IP "protocol"
  3021. An unsigned 8 bit number, read with
  3022. \f(CWstrtoul()\fP
  3023. \&.
  3024. .IP "size_t"
  3025. An unsigned number with size_t limitations, read with
  3026. \f(CWstrtoul\fP
  3027. \&.
  3028. .IP "sockname"
  3029. A socket address\&. See address\-option `bind\(cq\&
  3030. .IP "string"
  3031. A sequence of characters, not containing \(cq\&\e0\(cq\& and, depending on
  3032. the position within the command line, \(cq\&:\(cq\&, \(cq\&,\(cq\&, or \(dq\&!!\(dq\&\&. Note
  3033. that you might have to escape shell meta characters in the command line\&.
  3034. .IP "TCP service"
  3035. A service name, not starting with a digit, that is resolved by
  3036. \f(CWgetservbyname()\fP
  3037. , or an unsigned int 16 bit number read with
  3038. \f(CWstrtoul()\fP
  3039. \&.
  3040. .IP "timeval"
  3041. A double float specifying seconds; the number is mapped into a
  3042. struct timeval, consisting of seconds and microseconds\&.
  3043. .IP "timespec"
  3044. A double float specifying seconds; the number is mapped into a
  3045. struct timespec, consisting of seconds and nanoseconds\&.
  3046. .IP "UDP service"
  3047. A service name, not starting with a digit, that is resolved by
  3048. \f(CWgetservbyname()\fP
  3049. , or an unsigned int 16 bit number read with
  3050. \f(CWstrtoul()\fP
  3051. \&.
  3052. .IP "unsigned int"
  3053. A number read with
  3054. \f(CWstrtoul()\fP
  3055. \&. The value must fit into a C unsigned
  3056. int\&.
  3057. .IP "user"
  3058. If the first character is a decimal digit, the value is read with
  3059. \f(CWstrtoul()\fP
  3060. as unsigned integer specifying a user id\&. Otherwise, it must
  3061. be an existing user name\&.
  3062. .PP
  3063. .SH "EXAMPLES"
  3064. .PP
  3065. .IP "\fB\f(CWsocat \- TCP4:www\&.domain\&.org:80\fP\fP"
  3066. .IP
  3067. transfers data between STDIO (\-) and a
  3068. TCP4 connection to port 80 of host
  3069. www\&.domain\&.org\&. This example results in an interactive connection similar to
  3070. telnet or netcat\&. The stdin terminal parameters are not changed, so you may
  3071. close the relay with ^D or abort it with ^C\&.
  3072. .IP
  3073. \.LP
  3074. \.nf
  3075. \fBsocat -d -d READLINE,history=$HOME/.http_history \\
  3076. TCP4:www.domain.org:www,crnl\fP
  3077. \.fi
  3078. .IP
  3079. this is similar to the previous example, but you can edit the current line in a
  3080. bash like manner (READLINE) and use the
  3081. history file \&.http_history; \fBsocat\fP prints messages about
  3082. progress (\-d \-d)\&. The port is specified by service name
  3083. (www), and correct network line termination characters
  3084. (crnl) instead of NL are used\&.
  3085. .IP
  3086. .IP "\fB\f(CWsocat TCP4\-LISTEN:www TCP4:www\&.domain\&.org:www\fP\fP"
  3087. .IP
  3088. installs a simple TCP port forwarder\&. With
  3089. TCP4\-LISTEN it listens on local port \(dq\&www\(dq\& until a
  3090. connection comes in, accepts it, then connects to the remote host
  3091. (TCP4) and starts data transfer\&. It will not accept
  3092. a econd connection\&.
  3093. .IP
  3094. \.LP
  3095. \.nf
  3096. \fBsocat -d -d -lmlocal2 \\
  3097. TCP4-LISTEN:80,bind=myaddr1,reuseaddr,fork,su=nobody,range=10.0.0.0/8 \\
  3098. TCP4:www.domain.org:80,bind=myaddr2\fP
  3099. \.fi
  3100. .IP
  3101. TCP port forwarder, each side bound to another local IP address
  3102. (bind)\&. This example handles an almost
  3103. arbitrary number of parallel or consecutive connections by
  3104. fork\(cq\&ing a new
  3105. process after each
  3106. \f(CWaccept()\fP
  3107. \&. It provides a little security by
  3108. su\(cq\&ing to user
  3109. nobody after forking; it only permits connections from the private 10 network
  3110. (range); due to reuseaddr, it
  3111. allows immediate restart after master process\(cq\&s termination, even if some child
  3112. sockets are not completely shut down\&.
  3113. With \-lmlocal2, socat logs to stderr until successfully
  3114. reaching the accept loop\&. Further logging is directed to syslog with facility
  3115. local2\&.
  3116. .IP
  3117. \.LP
  3118. \.nf
  3119. \fBsocat TCP4-LISTEN:5555,fork,tcpwrap=script \\
  3120. EXEC:/bin/myscript,chroot=/home/sandbox,su-d=sandbox,pty,stderr\fP
  3121. \.fi
  3122. .IP
  3123. a simple server that accepts connections
  3124. (TCP4\-LISTEN) and fork\(cq\&s a new
  3125. child process for each connection; every child acts as single relay\&.
  3126. The client must match the rules for daemon process name \(dq\&script\(dq\& in
  3127. /etc/hosts\&.allow and /etc/hosts\&.deny, otherwise it is refused access (see \(dq\&man
  3128. 5 hosts_access\(dq\&)\&.
  3129. For EXEC\(cq\&uting the program, the child process
  3130. chroot\(cq\&s
  3131. to \fB/home/sandbox\fP, su\(cq\&s to user sandbox, and then starts
  3132. the program \fB/home/sandbox/bin/myscript\fP\&. \fBSocat\fP and
  3133. myscript communicate via a pseudo tty (pty); myscript\(cq\&s
  3134. stderr is redirected to stdout,
  3135. so its error messages are transferred via \fBsocat\fP to the connected client\&.
  3136. .IP
  3137. \.LP
  3138. \.nf
  3139. \fBsocat EXEC:"mail.sh target@domain.com",fdin=3,fdout=4 \\
  3140. TCP4:mail.relay.org:25,crnl,bind=alias1.server.org,mss=512\fP
  3141. \.fi
  3142. .IP
  3143. \fBmail\&.sh\fP is a shell script, distributed with \fBsocat\fP, that implements a
  3144. simple
  3145. SMTP client\&. It is programmed to \(dq\&speak\(dq\& SMTP on its FDs 3 (in) and 4 (out)\&.
  3146. The fdin and fdout options tell \fBsocat\fP
  3147. to use these FDs for communication with
  3148. the program\&. Because mail\&.sh inherits stdin and stdout while \fBsocat\fP does not
  3149. use them, the script can read a
  3150. mail body from stdin\&. \fBSocat\fP makes alias1 your local source address
  3151. (bind), cares for correct network line termination
  3152. (crnl) and sends
  3153. at most 512 data bytes per packet (mss)\&.
  3154. .IP
  3155. .IP "\fB\f(CWsocat \-,raw,echo=0,escape=0x0f /dev/ttyS0,raw,echo=0,crnl\fP\fP"
  3156. .IP
  3157. opens an interactive connection via the serial line, e\&.g\&. for talking with a
  3158. modem\&. raw and echo set the console\(cq\&s and
  3159. ttyS0\(cq\&s terminal parameters to practicable values, crnl
  3160. converts to correct newline characters\&. escape allows to
  3161. terminate the socat process with character control\-O\&.
  3162. Consider using READLINE instead of the first address\&.
  3163. .IP
  3164. \.LP
  3165. \.nf
  3166. \fBsocat UNIX-LISTEN:/tmp/.X11-unix/X1,fork \\
  3167. SOCKS4:host.victim.org:127.0.0.1:6000,socksuser=nobody,sourceport=20\fP
  3168. \.fi
  3169. .IP
  3170. with UNIX\-LISTEN, \fBsocat\fP opens a listening
  3171. UNIX domain socket \fB/tmp/\&.X11\-unix/X1\fP\&. This path corresponds
  3172. to local XWindow display :1 on your machine, so XWindow client connections to
  3173. DISPLAY=:1 are accepted\&. \fBSocat\fP then speaks with
  3174. the SOCKS4 server host\&.victim\&.org that might permit
  3175. sourceport 20 based connections due to an FTP related
  3176. weakness in its static IP filters\&. \fBSocat\fP
  3177. pretends to be invoked by socksuser nobody, and
  3178. requests to be connected to
  3179. loopback port 6000 (only weak sockd configurations will allow this)\&. So we get
  3180. a connection to the victims XWindow server and, if it does not require MIT
  3181. cookies or Kerberos authentication, we can start work\&. Please note that there
  3182. can only be one connection at a time, because TCP can establish only one
  3183. session with a given set of addresses and ports\&.
  3184. .IP
  3185. .IP "\fB\f(CWsocat \-u /tmp/readdata,seek\-end=0,ignoreeof \-\fP\fP"
  3186. .IP
  3187. this is an example for unidirectional data transfer
  3188. (\-u)\&. \fBSocat\fP transfers data
  3189. from file /tmp/readdata (implicit address GOPEN), starting
  3190. at its current end (seek\-end=0 lets \fBsocat\fP start
  3191. reading at current end of file; use seek=0 or no
  3192. seek option to first read the existing data) in a \(dq\&tail \-f\(dq\& like mode
  3193. (ignoreeof)\&. The \(dq\&file\(dq\&
  3194. might also be a listening UNIX domain socket (do not use a seek option then)\&.
  3195. .IP
  3196. \.LP
  3197. \.nf
  3198. \fB(sleep 5; echo PASSWORD; sleep 5; echo ls; sleep 1) |
  3199. socat - EXEC:'ssh -l user server',pty,setsid,ctty\fP
  3200. \.fi
  3201. .IP
  3202. EXEC\(cq\&utes an ssh session to server\&. Uses a pty for communication between \fBsocat\fP and
  3203. ssh, makes it ssh\(cq\&s controlling tty (ctty),
  3204. and makes this pty the owner of
  3205. a new process group (setsid), so ssh accepts the password from \fBsocat\fP\&.
  3206. .IP
  3207. \.LP
  3208. \.nf
  3209. \fBsocat -u TCP4-LISTEN:3334,reuseaddr,fork \\
  3210. OPEN:/tmp/in.log,creat,append\fP
  3211. \.fi
  3212. .IP
  3213. implements a simple network based message collector\&.
  3214. For each client connecting to port 3334, a new child process is generated (option fork)\&.
  3215. All data sent by the clients are append\(cq\&ed to the file /tmp/in\&.log\&.
  3216. If the file does not exist, socat creat\(cq\&s it\&.
  3217. Option reuseaddr allows immediate restart of the server
  3218. process\&.
  3219. .IP
  3220. .IP "\fB\f(CWsocat READLINE,noecho=\(cq\&[Pp]assword:\(cq\& EXEC:\(cq\&ftp ftp\&.server\&.com\(cq\&,pty,setsid,ctty\fP\fP"
  3221. .IP
  3222. wraps a command line history (READLINE) around the EXEC\(cq\&uted ftp client utility\&.
  3223. This allows editing and reuse of FTP commands for relatively comfortable
  3224. browsing through the ftp directory hierarchy\&. The password is echoed!
  3225. pty is required to have ftp issue a prompt\&.
  3226. Nevertheless, there may occur some confusion with the password and FTP
  3227. prompts\&.
  3228. .IP
  3229. (\fB\f(CWsocat PTY,link=$HOME/dev/vmodem0,raw,echo=0,wait\-slave EXEC:\(cq\&\(dq\&ssh modemserver\&.us\&.org socat \- /dev/ttyS0,nonblock,raw,echo=0\(dq\&\(cq\&\fP\fP)
  3230. .IP
  3231. generates a pseudo terminal
  3232. device (PTY) on the client that can be reached under the
  3233. symbolic link \fB$HOME/dev/vmodem0\fP\&.
  3234. An application that expects a serial line or modem
  3235. can be configured to use \fB$HOME/dev/vmodem0\fP; its traffic will be directed
  3236. to a modemserver via ssh where another socat instance links it with
  3237. \fB/dev/ttyS0\fP\&.
  3238. .IP
  3239. \.LP
  3240. \.nf
  3241. \fBsocat TCP4-LISTEN:2022,reuseaddr,fork \\
  3242. PROXY:proxy:www.domain.org:22,proxyport=3128,proxyauth=user:pass\fP
  3243. \.fi
  3244. .IP
  3245. starts a forwarder that accepts connections on port 2022, and directs them
  3246. through the proxy daemon listening on port 3128
  3247. (proxyport) on host proxy, using the
  3248. CONNECT method, where they are authenticated as \(dq\&user\(dq\& with \(dq\&pass\(dq\& (proxyauth)\&. The proxy
  3249. should establish connections to host www\&.domain\&.org on port 22 then\&.
  3250. .IP
  3251. .IP "\fB\f(CWsocat \- SSL:server:4443,cafile=server\&.crt,cert=client\&.pem\fP\fP"
  3252. .IP
  3253. is an OpenSSL client that tries to establish a secure connection to an SSL
  3254. server\&. Option cafile specifies a file that
  3255. contains trust certificates: we trust the server only when it presents one of
  3256. these certificates and proofs that it owns the related private key\&.
  3257. Otherwise the connection is terminated\&.
  3258. With cert a file containing the client certificate
  3259. and the associated private key is specified\&. This is required in case the
  3260. server wishes a client authentication; many Internet servers do not\&.
  3261. .br
  3262. The first address (\(cq\&\-\(cq\&) can be replaced by almost any other socat address\&.
  3263. .IP
  3264. .IP "\fB\f(CWsocat SSL\-LISTEN:4443,reuseaddr,pf=ip4,fork,cert=server\&.pem,cafile=client\&.crt PIPE\fP\fP"
  3265. .IP
  3266. is an OpenSSL server that accepts TCP connections, presents the certificate
  3267. from the file server\&.pem and forces the client to present a certificate that is
  3268. verified against cafile\&.crt\&.
  3269. .br
  3270. The second address (\(cq\&PIPE\(cq\&) can be replaced by almost any other socat
  3271. address\&.
  3272. .br
  3273. For instructions on generating and distributing OpenSSL keys and certificates
  3274. see the additional socat docu \f(CWsocat\-openssl\&.txt\fP\&.
  3275. .IP
  3276. .IP "\fB\f(CWecho |socat \-u \- file:/tmp/bigfile,create,largefile,seek=100000000000\fP\fP"
  3277. .IP
  3278. creates a 100GB sparse file; this requires a file system type that
  3279. supports this (ext2, ext3, reiserfs, jfs; not minix, vfat)\&. The operation of
  3280. writing 1 byte might take long (reiserfs: some minutes; ext2: \(dq\&no\(dq\& time), and
  3281. the resulting file can consume some disk space with just its inodes (reiserfs:
  3282. 2MB; ext2: 16KB)\&.
  3283. .IP
  3284. .IP "\fB\f(CWsocat tcp\-l:7777,reuseaddr,fork system:\(cq\&filan \-i 0 \-s >&2\(cq\&,nofork\fP\fP"
  3285. .IP
  3286. listens for incoming TCP connections on port 7777\&. For each accepted
  3287. connection, invokes a shell\&. This shell has its stdin and stdout directly
  3288. connected to the TCP socket (nofork)\&. The shell starts filan and lets it print the socket addresses to
  3289. stderr (your terminal window)\&.
  3290. .IP
  3291. .IP "\fB\f(CWecho \-e \(dq\&\e0\e14\e0\e0\ec\(dq\& |socat \-u \- file:/usr/bin/squid\&.exe,seek=0x00074420\fP\fP"
  3292. .IP
  3293. functions as primitive binary editor: it writes the 4 bytes 000 014 000 000 to
  3294. the executable /usr/bin/squid at offset 0x00074420 (this is a real world patch
  3295. to make the squid executable from Cygwin run under Windows, actual per May 2004)\&.
  3296. .IP
  3297. .IP "\fB\f(CWsocat \- tcp:www\&.blackhat\&.org:31337,readbytes=1000\fP\fP"
  3298. .IP
  3299. connects to an unknown service and prevents being flooded\&.
  3300. .IP
  3301. .IP "\fB\f(CWsocat \-U TCP:target:9999,end\-close TCP\-L:8888,reuseaddr,fork\fP\fP"
  3302. .IP
  3303. merges data arriving from different TCP streams on port 8888 to just one stream
  3304. to target:9999\&. The end\-close option prevents the child
  3305. processes forked off by the second address from terminating the shared
  3306. connection to 9999 (close\e(2) just unlinks the inode which stays active as long
  3307. as the parent process lives; shutdown\e(2) would actively terminate the
  3308. connection)\&.
  3309. .IP
  3310. .IP "\fB\f(CWsocat \- UDP4\-DATAGRAM:192\&.168\&.1\&.0:123,sp=123,broadcast,range=192\&.168\&.1\&.0/24\fP\fP"
  3311. .IP
  3312. sends a broadcast to the network 192\&.168\&.1\&.0/24 and receives the replies of the
  3313. timeservers there\&. Ignores NTP packets from hosts outside this network\&.
  3314. .IP
  3315. .IP "\fB\f(CWsocat \- SOCKET\-DATAGRAM:2:2:17:x007bxc0a80100x0000000000000000,bind=x007bx00000000x0000000000000000,setsockopt\-int=1:6:1,range=x0000xc0a80100x0000000000000000:x0000xffffff00x0000000000000000\fP\fP"
  3316. .IP
  3317. is semantically equivalent to the previous
  3318. example, but all parameters are
  3319. specified in generic form\&. the value 6 of setsockopt\-int is the Linux value for
  3320. \f(CWSO_BROADCAST\fP\&.
  3321. .IP
  3322. .IP "\fB\f(CWsocat \- IP4\-DATAGRAM:255\&.255\&.255\&.255:44,broadcast,range=10\&.0\&.0\&.0/8\fP\fP"
  3323. .IP
  3324. sends a broadcast to the local network\e(s) using protocol 44\&. Accepts replies
  3325. from the private address range only\&.
  3326. .IP
  3327. .IP "\fB\f(CWsocat \- UDP4\-DATAGRAM:224\&.255\&.0\&.1:6666,bind=:6666,ip\-add\-membership=224\&.255\&.0\&.1:eth0\fP\fP"
  3328. .IP
  3329. transfers data from stdin to the specified multicast address using UDP\&. Both
  3330. local and remote ports are 6666\&. Tells the interface eth0 to also accept
  3331. multicast packets of the given group\&. Multiple hosts on the local network can
  3332. run this command, so all data sent by any of the hosts will be received
  3333. by all the other ones\&. Note that there are many possible reasons for failure,
  3334. including IP\-filters, routing issues, wrong interface selection by the
  3335. operating system, bridges, or a badly configured switch\&.
  3336. .IP
  3337. .IP "\fB\f(CWsocat TCP:host2:4443 TUN:192\&.168\&.255\&.1/24,up\fP\fP"
  3338. .IP
  3339. establishes one side of a virtual (but not private!) network with host2 where a
  3340. similar process might run, with UDP\-L and tun address 192\&.168\&.255\&.2\&. They can
  3341. reach each other using the addresses 192\&.168\&.255\&.1 and 192\&.168\&.255\&.2\&. Note that
  3342. streaming eg\&. via TCP or SSL does not guarantee to retain packet boundaries and
  3343. may thus cause packet loss\&.
  3344. .IP
  3345. .IP "\fB\f(CWsocat PTY,link=/var/run/ppp,raw,echo=0 INTERFACE:hdlc0\fP\fP"
  3346. .IP
  3347. circumvents the problem that pppd requires a serial device and thus might not
  3348. be able to work on a synchronous line that is represented by a network device\&.
  3349. socat creates a PTY to make pppd happy, binds to the network
  3350. interface \f(CWhdlc0\fP, and can transfer data between
  3351. both devices\&. Use pppd on device \f(CW/var/run/ppp\fP then\&.
  3352. .IP
  3353. .IP "\fB\f(CWsocat \-T 1 \-d \-d TCP\-L:10081,reuseaddr,fork,crlf SYSTEM:\(dq\&echo \-e \e\(dq\&\e\e\e\(dq\&HTTP/1\&.0 200 OK\e\e\enDocumentType: text/plain\e\e\en\e\e\endate: \e$\e(date\e)\e\e\enserver:\e$SOCAT_SOCKADDR:\e$SOCAT_SOCKPORT\e\e\enclient: \e$SOCAT_PEERADDR:\e$SOCAT_PEERPORT\e\e\en\e\e\e\(dq\&\e\(dq\&; cat; echo \-e \e\(dq\&\e\e\e\(dq\&\e\e\en\e\e\e\(dq\&\e\(dq\&\(dq\&\fP\fP"
  3354. .IP
  3355. creates a simple HTTP echo server: each HTTP client that connects gets a valid
  3356. HTTP reply that contains information about the client address and port as it is
  3357. seen by the server host, the host address (which might vary on multihomed
  3358. servers), and the original client request\&.
  3359. .IP
  3360. .IP "\fB\f(CWsocat \-d \-d UDP4\-RECVFROM:9999,so\-broadcast,so\-timestamp,ip\-pktinfo,ip\-recverr,ip\-recvopts,ip\-recvtos,ip\-recvttl!!\- SYSTEM:\(cq\&export; sleep 1\(cq\& |grep SOCAT\fP\fP"
  3361. .IP
  3362. waits for an incoming UDP packet on port 9999 and prints the environment
  3363. variables provided by socat\&. On BSD based systems you have to replace
  3364. \f(CWip\-pktinfo\fP with \f(CWip\-recvdstaddr\fP,\f(CWip\-recvif\fP\&. Especially interesting is
  3365. SOCAT_IP_DSTADDR: it contains the target address of the packet which may be a
  3366. unicast, multicast, or broadcast address\&.
  3367. .IP
  3368. .IP "\fB\f(CW\fP\fP"
  3369. .IP
  3370. .SH "DIAGNOSTICS"
  3371. .PP
  3372. \fBSocat\fP uses a logging mechanism that allows to filter messages by severity\&. The
  3373. severities provided are more or less compatible to the appropriate syslog
  3374. priority\&. With one or up to four occurrences of the \-d command line option, the
  3375. lowest priority of messages that are issued can be selected\&. Each message
  3376. contains a single uppercase character specifying the messages severity (one of
  3377. F, E, W, N, I, or D)
  3378. .PP
  3379. .IP "FATAL:"
  3380. Conditions that require unconditional and immediate program termination\&.
  3381. .IP "ERROR:"
  3382. Conditions that prevent proper program processing\&. Usually the
  3383. program is terminated (see option \-s)\&.
  3384. .IP "WARNING:"
  3385. Something did not function correctly or is in a state where
  3386. correct further processing cannot be guaranteed, but might be possible\&.
  3387. .IP "NOTICE:"
  3388. Interesting actions of the program, e\&.g\&. for supervising \fBsocat\fP in some kind of server mode\&.
  3389. .IP "INFO:"
  3390. Description of what the program does, and maybe why it
  3391. happens\&. Allows to monitor the lifecycles of file descriptors\&.
  3392. .IP "DEBUG:"
  3393. Description of how the program works, all system or library calls and their results\&.
  3394. .PP
  3395. Log messages can be written to stderr, to a file, or to syslog\&.
  3396. .PP
  3397. On exit, \fBsocat\fP gives status 0 if it terminated due to EOF or inactivity
  3398. timeout, with a positive value on error, and with a negative value on fatal
  3399. error\&.
  3400. .PP
  3401. .SH "FILES"
  3402. .PP
  3403. /usr/bin/socat
  3404. .br
  3405. /usr/bin/filan
  3406. .br
  3407. /usr/bin/procan
  3408. .PP
  3409. .SH "ENVIRONMENT VARIABLES"
  3410. .PP
  3411. Input variables carry information from the environment to socat, output
  3412. variables are set by socat for use in executed scripts and programs\&.
  3413. .PP
  3414. In the output variables beginning with \(dq\&SOCAT\(dq\& this prefix is actually replaced
  3415. by the upper case name of the executable or the value of option
  3416. \-lp\&.
  3417. .PP
  3418. .IP "\fBSOCAT_DEFAULT_LISTEN_IP\fP (input)"
  3419. (Values 4 or 6) Sets the IP version to
  3420. be used for listen, recv, and recvfrom addresses if no
  3421. pf (protocol\-family) option is given\&. Is
  3422. overridden by socat options \-4 or \-6\&.
  3423. .IP
  3424. .IP "\fBSOCAT_PREFERRED_RESOLVE_IP\fP (input)"
  3425. (Values 0, 4, or 6) Sets the IP
  3426. version to
  3427. be used when resolving target host names when version is not specified by
  3428. address type, option pf (protocol\-family), or
  3429. address format\&. If name resolution does not return a matching entry, the first
  3430. result (with differing IP version) is taken\&. With value 0, socat always selects
  3431. the first record and its IP version\&.
  3432. .IP
  3433. .IP "\fBSOCAT_FORK_WAIT\fP (input)"
  3434. Specifies the time (seconds) to sleep the
  3435. parent and child processes after successful fork\e()\&. Useful for debugging\&.
  3436. .IP
  3437. .IP "\fBSOCAT_VERSION\fP (output)"
  3438. Socat sets this variable to its version string,
  3439. e\&.g\&. \f(CW\(dq\&1\&.7\&.0\&.0\(dq\&\fP for released versions or e\&.g\&. \f(CW\(dq\&1\&.6\&.0\&.1+envvar\(dq\&\fP for
  3440. temporary versions; can be used in scripts invoked by socat\&.
  3441. .IP
  3442. .IP "\fBSOCAT_PID\fP (output)"
  3443. Socat sets this variable to its process id\&. In case
  3444. of fork address option, SOCAT_PID gets the child processes
  3445. id\&. Forking for exec and system does
  3446. not change SOCAT_PID\&.
  3447. .IP
  3448. .IP "\fBSOCAT_PPID\fP (output)"
  3449. Socat sets this variable to its process id\&. In
  3450. case of fork, SOCAT_PPID keeps the pid of the master process\&.
  3451. .IP
  3452. .IP "\fBSOCAT_PEERADDR\fP (output)"
  3453. With passive socket addresses (all LISTEN and
  3454. RECVFROM addresses), this variable is set to a string describing the peers
  3455. socket address\&. Port information is not included\&.
  3456. .IP
  3457. .IP "\fBSOCAT_PEERPORT\fP (output)"
  3458. With appropriate passive socket addresses
  3459. (TCP, UDP, and SCTP \- LISTEN and RECVFROM), this variable is set to a string containing the
  3460. number of the peer port\&.
  3461. .IP
  3462. .IP "\fBSOCAT_SOCKADDR\fP (output)"
  3463. With all LISTEN addresses, this variable is
  3464. set to a string describing the local socket address\&. Port information is not
  3465. included example
  3466. .IP
  3467. .IP "\fBSOCAT_SOCKPORT\fP (output)"
  3468. With TCP\-LISTEN,
  3469. UDP\-LISTEN, and
  3470. SCTP\-LISTEN addresses, this variable is set to the
  3471. local port\&.
  3472. .IP
  3473. .IP "\fBSOCAT_TIMESTAMP\fP (output)"
  3474. With all RECVFROM addresses where address
  3475. option so\-timestamp is applied, socat sets this
  3476. variable to the resulting timestamp\&.
  3477. .IP
  3478. .IP "\fBSOCAT_IP_OPTIONS\fP (output)"
  3479. With all IPv4 based RECVFROM addresses where
  3480. address option ip\-recvopts is applied, socat fills
  3481. this variable with the IP options of the received packet\&.
  3482. .IP
  3483. .IP "\fBSOCAT_IP_DSTADDR\fP (output)"
  3484. With all IPv4 based RECVFROM addresses where
  3485. address option ip\-recvdstaddr (BSD) or
  3486. ip\-pktinfo (other platforms) is applied, socat sets
  3487. this variable to the destination address of the received packet\&. This is
  3488. particularly useful to identify broadcast and multicast addressed packets\&.
  3489. .IP
  3490. .IP "\fBSOCAT_IP_IF\fP (output)"
  3491. With all IPv4 based RECVFROM addresses where
  3492. address option ip\-recvif (BSD) or
  3493. ip\-pktinfo (other platforms) is applied, socat sets
  3494. this variable to the name of the interface where the packet was received\&.
  3495. .IP
  3496. .IP "\fBSOCAT_IP_LOCADDR\fP (output)"
  3497. With all IPv4 based RECVFROM
  3498. addresses where address option ip\-pktinfo is applied,
  3499. socat sets this variable to the address of the interface where the packet was
  3500. received\&.
  3501. .IP
  3502. .IP "\fBSOCAT_IP_TOS\fP (output)"
  3503. With all IPv4 based RECVFROM addresses where
  3504. address option ip\-recvtos is applied, socat sets this
  3505. variable to the TOS (type of service) of the received packet\&.
  3506. .IP
  3507. .IP "\fBSOCAT_IP_TTL\fP (output)"
  3508. With all IPv4 based RECVFROM addresses where
  3509. address option ip\-recvttl is applied, socat sets this
  3510. variable to the TTL (time to live) of the received packet\&.
  3511. .IP
  3512. .IP "\fBSOCAT_IPV6_HOPLIMIT\fP (output)"
  3513. With all IPv6 based RECVFROM addresses
  3514. where address option ipv6\-recvhoplimit is
  3515. applied, socat sets this variable to the hoplimit value of the received packet\&.
  3516. .IP
  3517. .IP "\fBSOCAT_IPV6_DSTADDR\fP (output)"
  3518. With all IPv6 based RECVFROM
  3519. addresses where address option ipv6\-recvpktinfo
  3520. is applied, socat sets this variable to the destination address of the received
  3521. packet\&.
  3522. .IP
  3523. .IP "\fBSOCAT_IPV6_TCLASS\fP (output)"
  3524. With all IPv6 based RECVFROM addresses
  3525. where address option ipv6\-recvtclass is applied,
  3526. socat sets this variable to the transfer class of the received packet\&.
  3527. .IP
  3528. .IP "\fBHOSTNAME\fP (input)"
  3529. Is used to determine the hostname for logging (see
  3530. \-lh)\&.
  3531. .IP
  3532. .IP "\fBLOGNAME\fP (input)"
  3533. Is used as name for the socks client user name if no
  3534. socksuser is given\&.
  3535. .br
  3536. With options su and
  3537. su\-d, LOGNAME is set to the given user name\&.
  3538. .IP
  3539. .IP "\fBUSER\fP (input)"
  3540. Is used as name for the socks client user name if no
  3541. socksuser is given and LOGNAME is empty\&.
  3542. .br
  3543. With options su and
  3544. su\-d, USER is set to the given user name\&.
  3545. .IP
  3546. .IP "\fBSHELL\fP (output)"
  3547. With options su and
  3548. su\-d, SHELL is set to the login shell of the
  3549. given user\&.
  3550. .IP
  3551. .IP "\fBPATH\fP (output)"
  3552. Can be set with option path for exec and
  3553. system addresses\&.
  3554. .IP
  3555. .IP "\fBHOME\fP (output)"
  3556. With options su and
  3557. su\-d, HOME is set to the home directory of the
  3558. given user\&.
  3559. .IP
  3560. .SH "CREDITS"
  3561. .PP
  3562. The work of the following groups and organizations was invaluable for this
  3563. project:
  3564. .PP
  3565. The \fIFSF\fP (GNU, http://www\&.fsf\&.org/ project
  3566. with their free and portable development software and
  3567. lots of other useful tools and libraries\&.
  3568. .PP
  3569. The \fILinux developers community\fP (http://www\&.linux\&.org/) for providing a free, open source operating
  3570. system\&.
  3571. .PP
  3572. The \fIOpen Group\fP (http://www\&.unix\-systems\&.org/) for making their
  3573. standard specifications available on the Internet for free\&.
  3574. .PP
  3575. .SH "VERSION"
  3576. .PP
  3577. This man page describes version 1\&.7\&.2 of \fBsocat\fP\&.
  3578. .PP
  3579. .SH "BUGS"
  3580. .PP
  3581. Addresses cannot be nested, so a single socat process cannot, e\&.g\&., drive ssl
  3582. over socks\&.
  3583. .PP
  3584. Address option ftruncate without value uses default 1 instead of 0\&.
  3585. .PP
  3586. Verbose modes (\-x and/or \-v) display line termination characters inconsistently
  3587. when address options cr or crnl are used: They show the data \fIafter\fP
  3588. conversion in either direction\&.
  3589. .PP
  3590. The data transfer blocksize setting (\-b) is ignored with address readline\&.
  3591. .PP
  3592. Send bug reports to <socat@dest\-unreach\&.org>
  3593. .PP
  3594. .SH "SEE ALSO"
  3595. .PP
  3596. nc\e(1), netcat6\e(1), sock\e(1), rinetd\e(8), cage\e(1), socks\&.conf\e(5), openssl\e(1),
  3597. stunnel\e(8), pty\e(1), rlwrap\e(1), setsid\e(1)
  3598. .PP
  3599. \fBSocat\fP home page http://www\&.dest\-unreach\&.org/socat/
  3600. .PP
  3601. .SH "AUTHOR"
  3602. .PP
  3603. Gerhard Rieger <rieger@dest\-unreach\&.org>