{
	"id": "a791eb60-43a1-4b6c-9d34-b80d3b36e81d",
	"created_at": "2026-04-06T00:18:08.314526Z",
	"updated_at": "2026-04-10T03:20:49.837099Z",
	"deleted_at": null,
	"sha1_hash": "9f11c73036453889b718489cab69874e439a4c63",
	"title": "socat(1): Multipurpose relay - Linux man page",
	"llm_title": "",
	"authors": "",
	"file_creation_date": "0001-01-01T00:00:00Z",
	"file_modification_date": "0001-01-01T00:00:00Z",
	"file_size": 192269,
	"plain_text": "socat(1): Multipurpose relay - Linux man page\r\nArchived: 2026-04-05 13:08:16 UTC\r\nName\r\nsocat - Multipurpose relay (SOcket CAT)\r\nSynopsis\r\nCWsocat [options] \u003caddress\u003e \u003caddress\u003e\r\nCWsocat -V\r\nCWsocat -h[h[h]] | -?[?[?]]\r\nCWfilan\r\nCWprocan\r\nDescription\r\nSocat is a command line based utility that establishes two bidirectional byte streams and transfers data between\r\nthem. Because the streams can be constructed from a large set of different types of data sinks and sources (see\r\naddress types), and because lots of address options may be applied to the streams, socat can be used for many\r\ndifferent purposes.\r\nFilan is a utility that prints information about its active file descriptors to stdout. It has been written for debugging\r\nsocat, but might be useful for other purposes too. Use the -h option to find more infos.\r\nProcan is a utility that prints information about process parameters to stdout. It has been written to better\r\nunderstand some UNIX process properties and for debugging socat, but might be useful for other purposes too.\r\nThe life cycle of a socat instance typically consists of four phases.\r\nIn the init phase, the command line options are parsed and logging is initialized.\r\nDuring the open phase, socat opens the first address and afterwards the second address. These steps are usually\r\nblocking; thus, especially for complex address types like socks, connection requests or authentication dialogs must\r\nbe completed before the next step is started.\r\nIn the transfer phase, socat watches both streamscq read and write file descriptors via CWselect() , and, when data\r\nis available on one side and can be written to the other side, socat reads it, performs newline character conversions\r\nif required, and writes the data to the write file descriptor of the other stream, then continues waiting for more data\r\nin both directions.\r\nWhen one of the streams effectively reaches EOF, the closing phase begins. Socat transfers the EOF condition to\r\nthe other stream, i.e. tries to shutdown only its write stream, giving it a chance to terminate gracefully. For a defined\r\ntime socat continues to transfer data in the other direction, but then closes all remaining channels and terminates.\r\nhttps://linux.die.net/man/1/socat\r\nPage 1 of 48\n\nOptions\r\nSocat provides some command line options that modify the behaviour of the program. They have nothing to do with\r\nso called address options that are used as parts of address specifications.\r\nCW-V\r\nPrint version and available feature information to stdout, and exit.\r\nCW-h | -?\r\nPrint a help text to stdout describing command line options and available address types, and exit.\r\nCW-hh | -??\r\nLike -h, plus a list of the short names of all available address options. Some options are platform dependend,\r\nso this output is helpful for checking the particular implementation.\r\nCW-hhh | -???\r\nLike -hh, plus a list of all available address option names.\r\nCW-d\r\nWithout this option, only fatal and error messages are generated; applying this option also prints warning\r\nmessages. See DIAGNOSTICS for more information.\r\nCW-d -d\r\nPrints fatal, error, warning, and notice messages.\r\nCW-d -d -d\r\nPrints fatal, error, warning, notice, and info messages.\r\nCW-d -d -d -d\r\nPrints fatal, error, warning, notice, info, and debug messages.\r\nCW-D\r\nLogs information about file descriptors before starting the transfer phase.\r\nCW-ly[\u003cfacility\u003e]\r\nWrites messages to syslog instead of stderr; severity as defined with -d option. With optional \u003cfacility\u003e, the\r\nsyslog type can be selected, default is dqdaemondq.\r\nCW-lfCW \u003clogfile\u003e\r\nWrites messages to \u003clogfile\u003e [filename] instead of stderr.\r\nCW-ls\r\nWrites messages to stderr (this is the default).\r\nCW-lpCW\u003cprogname\u003e\r\nOverrides the program name printed in error messages and used for constructing environment variable\r\nnames.\r\nCW-lu\r\nExtends the timestamp of error messages to microsecond resolution. Does not work when logging to syslog.\r\nCW-lm[\u003cfacility\u003e]\r\nMixed log mode. During startup messages are printed to stderr; when socat starts the transfer phase loop or\r\ndaemon mode (i.e. after opening all streams and before starting data transfer, or, with listening sockets with\r\nfork option, before the first accept call), it switches logging to syslog. With optional \u003cfacility\u003e, the syslog\r\ntype can be selected, default is dqdaemondq.\r\nCW-lh\r\nhttps://linux.die.net/man/1/socat\r\nPage 2 of 48\n\nAdds hostname to log messages. Uses the value from environment variable HOSTNAME or the value\r\nretrieved with CWuname() if HOSTNAME is not set.\r\nCW-v\r\nWrites the transferred data not only to their target streams, but also to stderr. The output format is text with\r\nsome conversions for readability, and prefixed with dq\u003e dq or dq\u003c dq indicating flow directions.\r\nCW-x\r\nWrites the transferred data not only to their target streams, but also to stderr. The output format is\r\nhexadecimal, prefixed with dq\u003e dq or dq\u003c dq indicating flow directions. Can be combined with CW-v .\r\nCW-bCW\u003csize\u003e\r\nSets the data transfer block \u003csize\u003e [size_t]. At most \u003csize\u003e bytes are transferred per step. Default is 8192\r\nbytes.\r\nCW-s\r\nBy default, socat terminates when an error occurred to prevent the process from running when some option\r\ncould not be applied. With this option, socat is sloppy with errors and tries to continue. Even with this\r\noption, socat will exit on fatals, and will abort connection attempts when security checks failed.\r\nCW-tCW\u003ctimeout\u003e\r\nWhen one channel has reached EOF, the write part of the other channel is shut down. Then, socat waits\r\n\u003ctimeout\u003e [timeval] seconds before terminating. Default is 0.5 seconds. This timeout only applies to\r\naddresses where write and read part can be closed independently. When during the timeout interval the read\r\npart gives EOF, socat terminates without awaiting the timeout.\r\nCW-TCW\u003ctimeout\u003e\r\nTotal inactivity timeout: when socat is already in the transfer loop and nothing has happened for \u003ctimeout\u003e\r\n[timeval] seconds (no data arrived, no interrupt occurred...) then it terminates. Useful with protocols like\r\nUDP that cannot transfer EOF.\r\nCW-u\r\nUses unidirectional mode. The first address is only used for reading, and the second address is only used for\r\nwriting (example).\r\nCW-U\r\nUses unidirectional mode in reverse direction. The first address is only used for writing, and the second\r\naddress is only used for reading.\r\nCW-g\r\nDuring address option parsing, doncqt check if the option is considered useful in the given address\r\nenvironment. Use it if you want to force, e.g., appliance of a socket option to a serial device.\r\nCW-LCW\u003clockfile\u003e\r\nIf lockfile exists, exits with error. If lockfile does not exist, creates it and continues, unlinks lockfile on exit.\r\nCW-WCW\u003clockfile\u003e\r\nIf lockfile exists, waits until it disappears. When lockfile does not exist, creates it and continues, unlinks\r\nlockfile on exit.\r\nCW-4\r\nUse IP version 4 in case that the addresses do not implicitly or explicitly specify a version; this is the default.\r\nCW-6\r\nUse IP version 6 in case that the addresses do not implicitly or explicitly specify a version.\r\nhttps://linux.die.net/man/1/socat\r\nPage 3 of 48\n\nAddress Specifications\r\nWith the address command line arguments, the user gives socat instructions and the necessary information for\r\nestablishing the byte streams.\r\nAn address specification usually consists of an address type keyword, zero or more required address parameters\r\nseparated by cq:cq from the keyword and from each other, and zero or more address options separated by cq,cq.\r\nThe keyword specifies the address type (e.g., TCP4, OPEN, EXEC). For some keywords there exist synonyms (cq-cq for STDIO, TCP for TCP4). Keywords are case insensitive. For a few special address types, the keyword may be\r\nomitted: Address specifications starting with a number are assumed to be FD (raw file descriptor) addresses; if a\r\ncq/cq is found before the first cq:cq or cq,cq, GOPEN (generic file open) is assumed.\r\nThe required number and type of address parameters depend on the address type. E.g., TCP4 requires a server\r\nspecification (name or address), and a port specification (number or service name).\r\nZero or more address options may be given with each address. They influence the address in some ways. Options\r\nconsist of an option keyword or an option keyword and a value, separated by cq=cq. Option keywords are case\r\ninsensitive. For filtering the options that are useful with an address type, each option is member of one option\r\ngroup. For each address type there is a set of option groups allowed. Only options belonging to one of these address\r\ngroups may be used (except with option -g).\r\nAddress specifications following the above schema are also called single address specifications. Two single\r\naddresses can be combined with dq!!dq to form a dual type address for one channel. Here, the first address is used\r\nby socat for reading data, and the second address for writing data. There is no way to specify an option only once\r\nfor being applied to both single addresses.\r\nUsually, addresses are opened in read/write mode. When an address is part of a dual address specification, or when\r\noption -u or -U is used, an address might be used only for reading or for writing. Considering this is important with\r\nsome address types.\r\nWith socat version 1.5.0 and higher, the lexical analysis tries to handle quotes and parenthesis meaningfully and\r\nallows escaping of special characters. If one of the characters ( { [ cq is found, the corresponding closing character -\r\n) } ] cq - is looked for; they may also be nested. Within these constructs, socats special characters and strings : , !!\r\nare not handled specially. All those characters and strings can be escaped with \\ or within dqdq\r\nAddress Types\r\nThis section describes the available address types with their keywords, parameters, and semantics.\r\nCWCREATE:\u003cfilename\u003e\r\nOpens \u003cfilename\u003e with CWcreat() and uses the file descriptor for writing. This address type requires write-only context, because a file opened with CWcreat cannot be read from.\r\nFlags like O_LARGEFILE cannot be applied. If you need them use OPEN with options create,create.\r\n\u003cfilename\u003e must be a valid existing or not existing path. If \u003cfilename\u003e is a named pipe, CWcreat() might\r\nblock; if \u003cfilename\u003e refers to a socket, this is an error.\r\nhttps://linux.die.net/man/1/socat\r\nPage 4 of 48\n\nOption groups: FD,REG,NAMED\r\nUseful options: mode, user, group, unlink-early, unlink-late, append\r\nSee also: OPEN, GOPEN\r\nCWEXEC:\u003ccommand-line\u003e\r\nForks a sub process that establishes communication with its parent process and invokes the specified\r\nprogram with CWexecvp() . \u003ccommand-line\u003e is a simple command with arguments separated by single\r\nspaces. If the program name contains a cq/cq, the part after the last cq/cq is taken as ARGV[0]. If the\r\nprogram name is a relative path, the CWexecvp() semantics for finding the program via CW$PATH apply.\r\nAfter successful program start, socat writes data to stdin of the process and reads from its stdout using a\r\nUNIX domain socket generated by CWsocketpair() per default. (example)\r\nOption groups: FD,SOCKET,EXEC,FORK,TERMIOS\r\nUseful options: path, fdin, fdout, chroot, su, su-d, nofork, pty, stderr, ctty, setsid, pipes, login, sigint, sigquit\r\nSee also: SYSTEM\r\nCWFD:\u003cfdnum\u003e\r\nUses the file descriptor \u003cfdnum\u003e. It must already exist as valid UN*X file descriptor.\r\nOption groups: FD (TERMIOS,REG,SOCKET)\r\nSee also: STDIO, STDIN, STDOUT, STDERR\r\nCWGOPEN:\u003cfilename\u003e\r\n(Generic open) This address type tries to handle any file system entry except directories usefully. \u003cfilename\u003e\r\nmay be a relative or absolute path. If it already exists, its type is checked. In case of a UNIX domain socket,\r\nsocat connects; if connecting fails, socat assumes a datagram socket and uses CWsendto() calls. If the entry\r\nis not a socket, socat opens it applying the CWO_APPEND flag. If it does not exist, it is opened with flag\r\nCWO_CREAT as a regular file (example).\r\nOption groups: FD,REG,SOCKET,NAMED,OPEN\r\nSee also: OPEN, CREATE, UNIX-CONNECT\r\nCWIP-SENDTO:\u003chost\u003e:\u003cprotocol\u003e\r\nOpens a raw IP socket. Depending on host specification or option pf, IP protocol version 4 or 6 is used. It\r\nuses \u003cprotocol\u003e to send packets to \u003chost\u003e [IP address] and receives packets from host, ignores packets from\r\nother hosts. Protocol 255 uses the raw socket with the IP header being part of the data.\r\nOption groups: FD,SOCKET,IP4,IP6\r\nUseful options: pf, ttl\r\nSee also: IP4-SENDTO, IP6-SENDTO, IP-RECVFROM, IP-RECV, UDP-SENDTO, UNIX-SENDTO\r\nCWINTERFACE:\u003cinterface\u003e\r\nCommunicates with a network connected on an interface using raw packets including link level data.\r\n\u003cinterface\u003e is the name of the network interface. Currently only available on Linux. Option groups:\r\nFD,SOCKET\r\nUseful options: pf, type\r\nSee also: ip-recv\r\nCWIP4-SENDTO:\u003chost\u003e:\u003cprotocol\u003e\r\nLike IP-SENDTO, but always uses IPv4.\r\nOption groups: FD,SOCKET,IP4\r\nCWIP6-SENDTO:\u003chost\u003e:\u003cprotocol\u003e\r\nhttps://linux.die.net/man/1/socat\r\nPage 5 of 48\n\nLike IP-SENDTO, but always uses IPv6.\r\nOption groups: FD,SOCKET,IP6\r\nCWIP-DATAGRAM:\u003caddress\u003e:\u003cprotocol\u003e\r\nSends outgoing data to the specified address which may in particular be a broadcast or multicast address.\r\nPackets arriving on the local socket are checked if their source addresses match RANGE or TCPWRAP\r\noptions. This address type can for example be used for implementing symmetric or asymmetric broadcast or\r\nmulticast communications.\r\nOption groups: FD, SOCKET, IP4, IP6, RANGE\r\nUseful options: bind, range, tcpwrap, broadcast, ip-multicast-loop, ip-multicast-ttl, ip-multicast-if, ip-add-membership, ttl, tos, pf\r\nSee also: IP4-DATAGRAM, IP6-DATAGRAM, IP-SENDTO, IP-RECVFROM, IP-RECV, UDP-DATAGRAM\r\nCWIP4-DATAGRAM:\u003chost\u003e:\u003cprotocol\u003e\r\nLike IP-DATAGRAM, but always uses IPv4. (example)\r\nOption groups: FD,SOCKET,IP4,RANGE\r\nCWIP6-DATAGRAM:\u003chost\u003e:\u003cprotocol\u003e\r\nLike IP-DATAGRAM, but always uses IPv6. Please note that IPv6 does not know broadcasts.\r\nOption groups: FD,SOCKET,IP6,RANGE\r\nCWIP-RECVFROM:\u003cprotocol\u003e\r\nOpens a raw IP socket of \u003cprotocol\u003e. Depending on option pf, IP protocol version 4 or 6 is used. It receives\r\none packet from an unspecified peer and may send one or more answer packets to that peer. This mode is\r\nparticularly useful with fork option where each arriving packet - from arbitrary peers - is handled by its own\r\nsub process. This allows a behaviour similar to typical UDP based servers like ntpd or named.\r\nPlease note that the reply packets might be fetched as incoming traffic when sender and receiver IP address\r\nare identical because there is no port number to distinguish the sockets.\r\nThis address works well with IP-SENDTO address peers (see above). Protocol 255 uses the raw socket with\r\nthe IP header being part of the data.\r\nOption groups: FD,SOCKET,IP4,IP6,CHILD,RANGE\r\nUseful options: pf, fork, range, ttl, broadcast\r\nSee also: IP4-RECVFROM, IP6-RECVFROM, IP-SENDTO, IP-RECV, UDP-RECVFROM, UNIX-RECVFROM\r\nCWIP4-RECVFROM:\u003cprotocol\u003e\r\nLike IP-RECVFROM, but always uses IPv4.\r\nOption groups: FD,SOCKET,IP4,CHILD,RANGE\r\nCWIP6-RECVFROM:\u003cprotocol\u003e\r\nLike IP-RECVFROM, but always uses IPv6.\r\nOption groups: FD,SOCKET,IP6,CHILD,RANGE\r\nCWIP-RECV:\u003cprotocol\u003e\r\nOpens a raw IP socket of \u003cprotocol\u003e. Depending on option pf, IP protocol version 4 or 6 is used. It receives\r\npackets from multiple unspecified peers and merges the data. No replies are possible. It can be, e.g.,\r\naddressed by socat IP-SENDTO address peers. Protocol 255 uses the raw socket with the IP header being\r\npart of the data.\r\nOption groups: FD,SOCKET,IP4,IP6,RANGE\r\nhttps://linux.die.net/man/1/socat\r\nPage 6 of 48\n\nUseful options: pf, range\r\nSee also: IP4-RECV, IP6-RECV, IP-SENDTO, IP-RECVFROM, UDP-RECV, UNIX-RECV\r\nCWIP4-RECV:\u003cprotocol\u003e\r\nLike IP-RECV, but always uses IPv4.\r\nOption groups: FD,SOCKET,IP4,RANGE\r\nCWIP6-RECV:\u003cprotocol\u003e\r\nLike IP-RECV, but always uses IPv6.\r\nOption groups: FD,SOCKET,IP6,RANGE\r\nCWOPEN:\u003cfilename\u003e\r\nOpens \u003cfilename\u003e using the CWopen() system call (example). This operation fails on UNIX domain sockets.\r\nNote: This address type is rarly useful in bidirectional mode.\r\nOption groups: FD,REG,NAMED,OPEN\r\nUseful options: creat, excl, noatime, nofollow, append, rdonly, wronly, lock, readbytes, ignoreeof\r\nSee also: CREATE, GOPEN, UNIX-CONNECT\r\nCWOPENSSL:\u003chost\u003e:\u003cport\u003e\r\nTries to establish a SSL connection to \u003cport\u003e [TCP service] on \u003chost\u003e [IP address] using TCP/IP version 4\r\nor 6 depending on address specification, name resolution, or option pf.\r\nNOTE: The server certificate is only checked for validity against cafile or capath, but not for match with the\r\nservercqs name or its IP address!\r\nOption groups: FD,SOCKET,IP4,IP6,TCP,OPENSSL,RETRY\r\nUseful options: cipher, method, verify, cafile, capath, certificate, key, compress, bind, pf, connect-timeout,\r\nsourceport, retry\r\nSee also: OPENSSL-LISTEN, TCP\r\nCWOPENSSL-LISTEN:\u003cport\u003e\r\nListens on tcp \u003cport\u003e [TCP service]. The IP version is 4 or the one specified with pf. When a connection is\r\naccepted, this address behaves as SSL server.\r\nNote: You probably want to use the certificate option with this address.\r\nNOTE: The client certificate is only checked for validity against cafile or capath, but not for match with the\r\nclientcqs name or its IP address!\r\nOption groups: FD,SOCKET,IP4,IP6,TCP,LISTEN,OPENSSL,CHILD,RANGE,RETRY\r\nUseful options: pf, cipher, method, verify, cafile, capath, certificate, key, compress, fork, bind, range,\r\ntcpwrap, su, reuseaddr, retry\r\nSee also: OPENSSL, TCP-LISTEN\r\nCWPIPE:\u003cfilename\u003e\r\nIf \u003cfilename\u003e already exists, it is opened. If it does not exist, a named pipe is created and opened. Beginning\r\nwith socat version 1.4.3, the named pipe is removed when the address is closed (but see option unlink-close\r\nNote: When a pipe is used for both reading and writing, it works as echo service.\r\nNote: When a pipe is used for both reading and writing, and socat tries to write more bytes than the pipe can\r\nbuffer (Linux 2.4: 2048 bytes), socat might block. Consider using socat option, e.g., CW-b 2048\r\nOption groups: FD,NAMED,OPEN\r\nUseful options: rdonly, nonblock, group, user, mode, unlink-early\r\nSee also: unnamed pipe\r\nCWPIPE\r\nhttps://linux.die.net/man/1/socat\r\nPage 7 of 48\n\nCreates an unnamed pipe and uses it for reading and writing. It works as an echo, because everything written\r\nto it appeares immediately as read data.\r\nNote: When socat tries to write more bytes than the pipe can queue (Linux 2.4: 2048 bytes), socat might\r\nblock. Consider, e.g., using option CW-b 2048\r\nOption groups: FD\r\nSee also: named pipe\r\nCWPROXY:\u003cproxy\u003e:\u003chostname\u003e:\u003cport\u003e\r\nConnects to an HTTP proxy server on port 8080 using TCP/IP version 4 or 6 depending on address\r\nspecification, name resolution, or option pf, and sends a CONNECT request for hostname:port. If the proxy\r\ngrants access and succeeds to connect to the target, data transfer between socat and the target can start. Note\r\nthat the traffic need not be HTTP but can be an arbitrary protocol.\r\nOption groups: FD,SOCKET,IP4,IP6,TCP,HTTP,RETRY\r\nUseful options: proxyport, ignorecr, proxyauth, resolve, crnl, bind, connect-timeout, mss, sourceport, retry\r\nSee also: SOCKS, TCP\r\nCWPTY\r\nGenerates a pseudo terminal (pty) and uses its master side. Another process may open the ptycqs slave side\r\nusing it like a serial line or terminal. (example). If both the ptmx and the openpty mechanisms are available,\r\nptmx is used (POSIX).\r\nOption groups: FD,NAMED,PTY,TERMIOS\r\nUseful options: link, openpty, wait-slave, mode, user, group\r\nSee also: UNIX-LISTEN, PIPE, EXEC, SYSTEM\r\nCWREADLINE\r\nUses GNU readline and history on stdio to allow editing and reusing input lines (example). This requires the\r\nGNU readline and history libraries. Note that stdio should be a (pseudo) terminal device, otherwise readline\r\ndoes not seem to work.\r\nOption groups: FD,READLINE,TERMIOS\r\nUseful options: history, noecho\r\nSee also: STDIO\r\nCWSCTP-CONNECT:\u003chost\u003e:\u003cport\u003e\r\nEstablishes an SCTP stream connection to the specified \u003chost\u003e [IP address] and \u003cport\u003e [TCP service] using\r\nTCP/IP version 4 or 6 depending on address specification, name resolution, or option pf.\r\nOption groups: FD,SOCKET,IP4,IP6,SCTP,CHILD,RETRY\r\nUseful options: bind, pf, connect-timeout, tos, mtudiscover, sctp-maxseg, sctp-nodelay, nonblock,\r\nsourceport, retry, readbytes\r\nSee also: SCTP4-CONNECT, SCTP6-CONNECT, SCTP-LISTEN, TCP-CONNECT\r\nCWSCTP4-CONNECT:\u003chost\u003e:\u003cport\u003e\r\nLike SCTP-CONNECT, but only supports IPv4 protocol.\r\nOption groups: FD,SOCKET,IP4,SCTP,CHILD,RETRY\r\nCWSCTP6-CONNECT:\u003chost\u003e:\u003cport\u003e\r\nLike SCTP-CONNECT, but only supports IPv6 protocol.\r\nOption groups: FD,SOCKET,IP6,SCTP,CHILD,RETRY\r\nCWSCTP-LISTEN:\u003cport\u003e\r\nhttps://linux.die.net/man/1/socat\r\nPage 8 of 48\n\nListens on \u003cport\u003e [TCP service] and accepts a TCP/IP connection. The IP version is 4 or the one specified\r\nwith address option pf, socat option (-4, -6), or environment variable SOCAT_DEFAULT_LISTEN_IP. Note\r\nthat opening this address usually blocks until a client connects.\r\nOption groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6,SCTP,RETRY\r\nUseful options: crnl, fork, bind, range, tcpwrap, pf, max-children, backlog, sctp-maxseg, sctp-nodelay, su,\r\nreuseaddr, retry, cool-write\r\nSee also: SCTP4-LISTEN, SCTP6-LISTEN, TCP-LISTEN, SCTP-CONNECT\r\nCWSCTP4-LISTEN:\u003cport\u003e\r\nLike SCTP-LISTEN, but only supports IPv4 protocol.\r\nOption groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,SCTP,RETRY\r\nCWSCTP6-LISTEN:\u003cport\u003e\r\nLike SCTP-LISTEN, but only supports IPv6 protocol.\r\nOption groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP6,SCTP,RETRY\r\nCWSOCKET-CONNECT:\u003cdomain\u003e:\u003cprotocol\u003e:\u003cremote-address\u003e\r\nCreates a stream socket using the first and second given socket parameters and CWSOCK_STREAM (see\r\nman socket\\(2)) and connects to the remote-address. The two socket parameters have to be specified by int\r\nnumbers. Consult your OS documentation and include files to find the appropriate values. The remote-address must be the data representation of a sockaddr structure without sa_family and (BSD) sa_len\r\ncomponents.\r\nPlease note that you can - beyond the options of the specified groups - also use options of higher level\r\nprotocols when you apply socat option -g.\r\nOption groups: FD,SOCKET,CHILD,RETRY\r\nUseful options: bind, setsockopt-int, setsockopt-bin, setsockopt-string\r\nSee also: TCP, UDP-CONNECT, UNIX-CONNECT, SOCKET-LISTEN, SOCKET-SENDTO\r\nCWSOCKET-DATAGRAM:\u003cdomain\u003e:\u003ctype\u003e:\u003cprotocol\u003e:\u003cremote-address\u003e\r\nCreates a datagram socket using the first three given socket parameters (see man socket\\(2)) and sends\r\noutgoing data to the remote-address. The three socket parameters have to be specified by int numbers.\r\nConsult your OS documentation and include files to find the appropriate values. The remote-address must be\r\nthe data representation of a sockaddr structure without sa_family and (BSD) sa_len components.\r\nPlease note that you can - beyond the options of the specified groups - also use options of higher level\r\nprotocols when you apply socat option -g.\r\nOption groups: FD,SOCKET,RANGE\r\nUseful options: bind, range, setsockopt-int, setsockopt-bin, setsockopt-string\r\nSee also: UDP-DATAGRAM, IP-DATAGRAM, SOCKET-SENDTO, SOCKET-RECV, SOCKET-RECVFROM\r\nCWSOCKET-LISTEN:\u003cdomain\u003e:\u003cprotocol\u003e:\u003clocal-address\u003e\r\nCreates a stream socket using the first and second given socket parameters and CWSOCK_STREAM (see\r\nman socket\\(2)) and waits for incoming connections on local-address. The two socket parameters have to be\r\nspecified by int numbers. Consult your OS documentation and include files to find the appropriate values.\r\nThe local-address must be the data representation of a sockaddr structure without sa_family and (BSD)\r\nsa_len components.\r\nPlease note that you can - beyond the options of the specified groups - also use options of higher level\r\nprotocols when you apply socat option -g.\r\nhttps://linux.die.net/man/1/socat\r\nPage 9 of 48\n\nOption groups: FD,SOCKET,LISTEN,RANGE,CHILD,RETRY\r\nUseful options: setsockopt-int, setsockopt-bin, setsockopt-string\r\nSee also: TCP, UDP-CONNECT, UNIX-CONNECT, SOCKET-LISTEN, SOCKET-SENDTO, SOCKET-SENDTO\r\nCWSOCKET-RECV:\u003cdomain\u003e:\u003ctype\u003e:\u003cprotocol\u003e:\u003clocal-address\u003e\r\nCreates a socket using the three given socket parameters (see man socket\\(2)) and binds it to \u003clocal-address\u003e. Receives arriving data. The three parameters have to be specified by int numbers. Consult your OS\r\ndocumentation and include files to find the appropriate values. The local-address must be the data\r\nrepresentation of a sockaddr structure without sa_family and (BSD) sa_len components.\r\nOption groups: FD,SOCKET,RANGE\r\nUseful options: range, setsockopt-int, setsockopt-bin, setsockopt-string\r\nSee also: UDP-RECV, IP-RECV, UNIX-RECV, SOCKET-DATAGRAM, SOCKET-SENDTO, SOCKET-RECVFROM\r\nCWSOCKET-RECVFROM:\u003cdomain\u003e:\u003ctype\u003e:\u003cprotocol\u003e:\u003clocal-address\u003e\r\nCreates a socket using the three given socket parameters (see man socket\\(2)) and binds it to \u003clocal-address\u003e. Receives arriving data and sends replies back to the sender. The first three parameters have to be\r\nspecified as int numbers. Consult your OS documentation and include files to find the appropriate values.\r\nThe local-address must be the data representation of a sockaddr structure without sa_family and (BSD)\r\nsa_len components.\r\nOption groups: FD,SOCKET,CHILD,RANGE\r\nUseful options: fork, range, setsockopt-int, setsockopt-bin, setsockopt-string\r\nSee also: UDP-RECVFROM, IP-RECVFROM, UNIX-RECVFROM, SOCKET-DATAGRAM, SOCKET-SENDTO, SOCKET-RECV\r\nCWSOCKET-SENDTO:\u003cdomain\u003e:\u003ctype\u003e:\u003cprotocol\u003e:\u003cremote-address\u003e\r\nCreates a socket using the three given socket parameters (see man socket\\(2)). Sends outgoing data to the\r\ngiven address and receives replies. The three parameters have to be specified as int numbers. Consult your\r\nOS documentation and include files to find the appropriate values. The remote-address must be the data\r\nrepresentation of a sockaddr structure without sa_family and (BSD) sa_len components.\r\nOption groups: FD,SOCKET\r\nUseful options: bind, setsockopt-int, setsockopt-bin, setsockopt-string\r\nSee also: UDP-SENDTO, IP-SENDTO, UNIX-SENDTO, SOCKET-DATAGRAM, SOCKET-RECV\r\nSOCKET-RECVFROM\r\nCWSOCKS4:\u003csocks-server\u003e:\u003chost\u003e:\u003cport\u003e\r\nConnects via \u003csocks-server\u003e [IP address] to \u003chost\u003e [IPv4 address] on \u003cport\u003e [TCP service], using socks\r\nversion 4 protocol over IP version 4 or 6 depending on address specification, name resolution, or option pf\r\n(example).\r\nOption groups: FD,SOCKET,IP4,IP6,TCP,SOCKS4,RETRY\r\nUseful options: socksuser, socksport, sourceport, pf, retry\r\nSee also: SOCKS4A, PROXY, TCP\r\nCWSOCKS4A:\u003csocks-server\u003e:\u003chost\u003e:\u003cport\u003e\r\nlike SOCKS4, but uses socks protocol version 4a, thus leaving host name resolution to the socks server.\r\nOption groups: FD,SOCKET,IP4,IP6,TCP,SOCKS4,RETRY\r\nCWSTDERR\r\nhttps://linux.die.net/man/1/socat\r\nPage 10 of 48\n\nUses file descriptor 2.\r\nOption groups: FD (TERMIOS,REG,SOCKET)\r\nSee also: FD\r\nCWSTDIN\r\nUses file descriptor 0.\r\nOption groups: FD (TERMIOS,REG,SOCKET)\r\nUseful options: readbytes\r\nSee also: FD\r\nCWSTDIO\r\nUses file descriptor 0 for reading, and 1 for writing.\r\nOption groups: FD (TERMIOS,REG,SOCKET)\r\nUseful options: readbytes\r\nSee also: FD\r\nCWSTDOUT\r\nUses file descriptor 1.\r\nOption groups: FD (TERMIOS,REG,SOCKET)\r\nSee also: FD\r\nCWSYSTEM:\u003cshell-command\u003e\r\nForks a sub process that establishes communication with its parent process and invokes the specified\r\nprogram with CWsystem() . Please note that \u003cshell-command\u003e [string] must not contain cq,cq or dq!!dq, and\r\nthat shell meta characters may have to be protected. After successful program start, socat writes data to stdin\r\nof the process and reads from its stdout.\r\nOption groups: FD,SOCKET,EXEC,FORK,TERMIOS\r\nUseful options: path, fdin, fdout, chroot, su, su-d, nofork, pty, stderr, ctty, setsid, pipes, sigint, sigquit\r\nSee also: EXEC\r\nCWTCP:\u003chost\u003e:\u003cport\u003e\r\nConnects to \u003cport\u003e [TCP service] on \u003chost\u003e [IP address] using TCP/IP version 4 or 6 depending on address\r\nspecification, name resolution, or option pf.\r\nOption groups: FD,SOCKET,IP4,IP6,TCP,RETRY\r\nUseful options: crnl, bind, pf, connect-timeout, tos, mtudiscover, mss, nodelay, nonblock, sourceport, retry,\r\nreadbytes\r\nSee also: TCP4, TCP6, TCP-LISTEN, UDP, SCTP-CONNECT, UNIX-CONNECT\r\nCWTCP4:\u003chost\u003e:\u003cport\u003e\r\nLike TCP, but only supports IPv4 protocol (example).\r\nOption groups: FD,SOCKET,IP4,TCP,RETRY\r\nCWTCP6:\u003chost\u003e:\u003cport\u003e\r\nLike TCP, but only supports IPv6 protocol.\r\nOption groups: FD,SOCKET,IP6,TCP,RETRY\r\nCWTCP-LISTEN:\u003cport\u003e\r\nListens on \u003cport\u003e [TCP service] and accepts a TCP/IP connection. The IP version is 4 or the one specified\r\nwith address option pf, socat option (-4, -6), or environment variable SOCAT_DEFAULT_LISTEN_IP. Note\r\nthat opening this address usually blocks until a client connects.\r\nOption groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6,TCP,RETRY\r\nhttps://linux.die.net/man/1/socat\r\nPage 11 of 48\n\nUseful options: crnl, fork, bind, range, tcpwrap, pf, max-children, backlog, mss, su, reuseaddr, retry, cool-write\r\nSee also: TCP4-LISTEN, TCP6-LISTEN, UDP-LISTEN, SCTP-LISTEN, UNIX-LISTEN, OPENSSL-LISTEN, TCP-CONNECT\r\nCWTCP4-LISTEN:\u003cport\u003e\r\nLike TCP-LISTEN, but only supports IPv4 protocol (example).\r\nOption groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,TCP,RETRY\r\nCWTCP6-LISTEN:\u003cport\u003e\r\nLike TCP-LISTEN, but only supports IPv6 protocol.\r\nAdditional useful option: ipv6only\r\nOption groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP6,TCP,RETRY\r\nCWTUN[:\u003cif-addr\u003e/\u003cbits\u003e]\r\nCreates a Linux TUN/TAP device and optionally assignes it the address and netmask given by the\r\nparameters. The resulting network interface is almost ready for use by other processes; socat serves its\r\ndqwire sidedq. This address requires read and write access to the tunnel cloning device, usually\r\nCW/dev/net/tun , as well as permission to set some CWioctl()s. Option iff-up is required to immediately\r\nactivate the interface!\r\nOption groups: FD,NAMED,OPEN,TUN\r\nUseful options: iff-up, tun-device, tun-name, tun-type, iff-no-pi\r\nSee also: ip-recv\r\nCWUDP:\u003chost\u003e:\u003cport\u003e\r\nConnects to \u003cport\u003e [UDP service] on \u003chost\u003e [IP address] using UDP/IP version 4 or 6 depending on address\r\nspecification, name resolution, or option pf.\r\nPlease note that, due to UDP protocol properties, no real connection is established; data has to be sent for\r\n'connectingcq to the server, and no end-of-file condition can be transported.\r\nOption groups: FD,SOCKET,IP4,IP6\r\nUseful options: ttl, tos, bind, sourceport, pf\r\nSee also: UDP4, UDP6, UDP-LISTEN, TCP, IP\r\nCWUDP4:\u003chost\u003e:\u003cport\u003e\r\nLike UDP, but only supports IPv4 protocol.\r\nOption groups: FD,SOCKET,IP4\r\nCWUDP6:\u003chost\u003e:\u003cport\u003e\r\nLike UDP, but only supports IPv6 protocol.\r\nOption groups: FD,SOCKET,IP6\r\nCWUDP-DATAGRAM:\u003caddress\u003e:\u003cport\u003e\r\nSends outgoing data to the specified address which may in particular be a broadcast or multicast address.\r\nPackets arriving on the local socket are checked for the correct remote port and if their source addresses\r\nmatch RANGE or TCPWRAP options. This address type can for example be used for implementing\r\nsymmetric or asymmetric broadcast or multicast communications.\r\nOption groups: FD,SOCKET,IP4,IP6,RANGE\r\nUseful options: bind, range, tcpwrap, broadcast, ip-multicast-loop, ip-multicast-ttl, ip-multicast-if, ip-add-membership, ttl, tos, sourceport, pf\r\nhttps://linux.die.net/man/1/socat\r\nPage 12 of 48\n\nSee also: UDP4-DATAGRAM, UDP6-DATAGRAM, UDP-SENDTO, UDP-RECVFROM, UDP-RECV,\r\nUDP-CONNECT, UDP-LISTEN, IP-DATAGRAM\r\nCWUDP4-DATAGRAM:\u003caddress\u003e:\u003cport\u003e\r\nLike UDP-DATAGRAM, but only supports IPv4 protocol (example1, example2).\r\nOption groups: FD,SOCKET,IP4, RANGE\r\nCWUDP6-DATAGRAM:\u003caddress\u003e:\u003cport\u003e\r\nLike UDP-DATAGRAM, but only supports IPv6 protocol.\r\nOption groups: FD,SOCKET,IP6,RANGE\r\nCWUDP-LISTEN:\u003cport\u003e\r\nWaits for a UDP/IP packet arriving on \u003cport\u003e [UDP service] and 'connectscq back to sender. The accepted IP\r\nversion is 4 or the one specified with option pf. Please note that, due to UDP protocol properties, no real\r\nconnection is established; data has to arrive from the peer first, and no end-of-file condition can be\r\ntransported. Note that opening this address usually blocks until a client connects.\r\nOption groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6\r\nUseful options: fork, bind, range, pf\r\nSee also: UDP, UDP4-LISTEN, UDP6-LISTEN, TCP-LISTEN\r\nCWUDP4-LISTEN:\u003cport\u003e\r\nLike UDP-LISTEN, but only support IPv4 protocol.\r\nOption groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4\r\nCWUDP6-LISTEN:\u003cport\u003e\r\nLike UDP-LISTEN, but only support IPv6 protocol.\r\nOption groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP6\r\nCWUDP-SENDTO:\u003chost\u003e:\u003cport\u003e\r\nCommunicates with the specified peer socket, defined by \u003cport\u003e [UDP service] on \u003chost\u003e [IP address],\r\nusing UDP/IP version 4 or 6 depending on address specification, name resolution, or option pf. It sends\r\npackets to and receives packets from that peer socket only. This address effectively implements a datagram\r\nclient. It works well with socat UDP-RECVFROM and UDP-RECV address peers.\r\nOption groups: FD,SOCKET,IP4,IP6\r\nUseful options: ttl, tos, bind, sourceport, pf\r\nSee also: UDP4-SENDTO, UDP6-SENDTO, UDP-RECVFROM, UDP-RECV, UDP-CONNECT, UDP-LISTEN, IP-SENDTO\r\nCWUDP4-SENDTO:\u003chost\u003e:\u003cport\u003e\r\nLike UDP-SENDTO, but only supports IPv4 protocol.\r\nOption groups: FD,SOCKET,IP4\r\nCWUDP6-SENDTO:\u003chost\u003e:\u003cport\u003e\r\nLike UDP-SENDTO, but only supports IPv6 protocol.\r\nOption groups: FD,SOCKET,IP6\r\nCWUDP-RECVFROM:\u003cport\u003e\r\nCreates a UDP socket on \u003cport\u003e [UDP service] using UDP/IP version 4 or 6 depending on option pf. It\r\nreceives one packet from an unspecified peer and may send one or more answer packets to that peer. This\r\nmode is particularly useful with fork option where each arriving packet - from arbitrary peers - is handled by\r\nits own sub process. This allows a behaviour similar to typical UDP based servers like ntpd or named. This\r\naddress works well with socat UDP-SENDTO address peers.\r\nhttps://linux.die.net/man/1/socat\r\nPage 13 of 48\n\nOption groups: FD,SOCKET,IP4,IP6,CHILD,RANGE\r\nUseful options: fork, ttl, tos, bind, sourceport, pf\r\nSee also: UDP4-RECVFROM, UDP6-RECVFROM, UDP-SENDTO, UDP-RECV, UDP-CONNECT, UDP-LISTEN, IP-RECVFROM, UNIX-RECVFROM\r\nCWUDP4-RECVFROM:\u003cport\u003e\r\nLike UDP-RECVFROM, but only supports IPv4 protocol.\r\nOption groups: FD,SOCKET,IP4,CHILD,RANGE\r\nCWUDP6-RECVFROM:\u003cport\u003e\r\nLike UDP-RECVFROM, but only supports IPv6 protocol.\r\nOption groups: FD,SOCKET,IP6,CHILD,RANGE\r\nCWUDP-RECV:\u003cport\u003e\r\nCreates a UDP socket on \u003cport\u003e [UDP service] using UDP/IP version 4 or 6 depending on option pf. It\r\nreceives packets from multiple unspecified peers and merges the data. No replies are possible. It works well\r\nwith, e.g., socat UDP-SENDTO address peers; it behaves similar to a syslog server.\r\nOption groups: FD,SOCKET,IP4,IP6,RANGE\r\nUseful options: fork, pf, bind, sourceport, ttl, tos\r\nSee also: UDP4-RECV, UDP6-RECV, UDP-SENDTO, UDP-RECVFROM, UDP-CONNECT, UDP-LISTEN, IP-RECV, UNIX-RECV\r\nCWUDP4-RECV:\u003cport\u003e\r\nLike UDP-RECV, but only supports IPv4 protocol.\r\nOption groups: FD,SOCKET,IP4,RANGE\r\nCWUDP6-RECV:\u003cport\u003e\r\nLike UDP-RECV, but only supports IPv6 protocol.\r\nOption groups: FD,SOCKET,IP6,RANGE\r\nCWUNIX-CONNECT:\u003cfilename\u003e\r\nConnects to \u003cfilename\u003e assuming it is a UNIX domain socket. If \u003cfilename\u003e does not exist, this is an error;\r\nif \u003cfilename\u003e is not a UNIX domain socket, this is an error; if \u003cfilename\u003e is a UNIX domain socket, but no\r\nprocess is listening, this is an error.\r\nOption groups: FD,SOCKET,NAMED,RETRY,UNIX\r\n) Useful options: bind\r\nSee also: UNIX-LISTEN, UNIX-SENDTO, TCP\r\nCWUNIX-LISTEN:\u003cfilename\u003e\r\nListens on \u003cfilename\u003e using a UNIX domain stream socket and accepts a connection. If \u003cfilename\u003e exists\r\nand is not a socket, this is an error. If \u003cfilename\u003e exists and is a UNIX domain socket, binding to the address\r\nfails (use option unlink-early!). Note that opening this address usually blocks until a client connects.\r\nBeginning with socat version 1.4.3, the file system entry is removed when this address is closed (but see\r\noption unlink-close) (example).\r\nOption groups: FD,SOCKET,NAMED,LISTEN,CHILD,RETRY,UNIX\r\nUseful options: fork, umask, mode, user, group, unlink-early\r\nSee also: UNIX-CONNECT, UNIX-RECVFROM, UNIX-RECV, TCP-LISTEN\r\nCWUNIX-SENDTO:\u003cfilename\u003e\r\nCommunicates with the specified peer socket, defined by [\u003cfilename\u003e] assuming it is a UNIX domain\r\ndatagram socket. It sends packets to and receives packets from that peer socket only. Please note that it might\r\nhttps://linux.die.net/man/1/socat\r\nPage 14 of 48\n\nbe neccessary to bind the local socket to an address (e.g. CW/tmp/sock1, which must not exist before). This\r\naddress type works well with socat UNIX-RECVFROM and UNIX-RECV address peers.\r\nOption groups: FD,SOCKET,NAMED,UNIX\r\nUseful options: bind\r\nSee also: UNIX-RECVFROM, UNIX-RECV, UNIX-CONNECT, UDP-SENDTO, IP-SENDTO\r\nCWUNIX-RECVFROM:\u003cfilename\u003e\r\nCreates a UNIX domain datagram socket [\u003cfilename\u003e]. Receives one packet and may send one or more\r\nanswer packets to that peer. This mode is particularly useful with fork option where each arriving packet -\r\nfrom arbitrary peers - is handled by its own sub process. This address works well with socat UNIX-SENDTO\r\naddress peers.\r\nOption groups: FD,SOCKET,NAMED,CHILD,UNIX\r\nUseful options: fork\r\nSee also: UNIX-SENDTO, UNIX-RECV, UNIX-LISTEN, UDP-RECVFROM, IP-RECVFROM\r\nCWUNIX-RECV:\u003cfilename\u003e\r\nCreates a UNIX domain datagram socket [\u003cfilename\u003e]. Receives packets from multiple unspecified peers\r\nand merges the data. No replies are possible. It can be, e.g., addressed by socat UNIX-SENDTO address\r\npeers. It behaves similar to a syslog server. Option groups: FD,SOCKET,NAMED,UNIX\r\nSee also: UNIX-SENDTO, UNIX-RECVFROM, UNIX-LISTEN, UDP-RECV, IP-RECV\r\nCWUNIX-CLIENT:\u003cfilename\u003e\r\nCommunicates with the specified peer socket, defined by [\u003cfilename\u003e] assuming it is a UNIX domain\r\nsocket. It first tries to connect and, if that fails, assumes it is a datagram socket, thus supporting both types.\r\nOption groups: FD,SOCKET,NAMED,UNIX\r\nUseful options: bind\r\nSee also: UNIX-CONNECT, UNIX-SENDTO, GOPEN\r\nCWABSTRACT-CONNECT:\u003cstring\u003e\r\nCWABSTRACT-LISTEN:\u003cstring\u003e\r\nCWABSTRACT-SENDTO:\u003cstring\u003e\r\nCWABSTRACT-RECVFROM:\u003cstring\u003e\r\nCWABSTRACT-RECV:\u003cstring\u003e\r\nCWABSTRACT-CLIENT:\u003cstring\u003e\r\nThe ABSTRACT addresses are almost identical to the related UNIX addresses except that they do not\r\naddress file system based sockets but an alternate UNIX domain address space. To archieve this the socket\r\naddress strings are prefixed with dq\\0dq internally. This feature is available (only?) on Linux. Option groups\r\nare the same as with the related UNIX addresses, except that the ABSTRACT addresses are not member of\r\nthe NAMED group.\r\nAddress Options\r\nAddress options can be applied to address specifications to influence the process of opening the addresses and the\r\nproperties of the resulting data channels.\r\nFor technical reasons not every option can be applied to every address type; e.g., applying a socket option to a\r\nregular file will fail. To catch most useless combinations as early as in the open phase, the concept of option groups\r\nhttps://linux.die.net/man/1/socat\r\nPage 15 of 48\n\nwas introduced. Each option belongs to one or more option groups. Options can be used only with address types that\r\nsupport at least one of their option groups (but see option -g).\r\nAddress options have data types that their values must conform to. Every address option consists of just a keyword\r\nor a keyword followed by dq=valuedq, where value must conform to the options type. Some address options\r\nmanipulate parameters of system calls; e.g., option sync sets the CWO_SYNC flag with the CWopen() call. Other\r\noptions cause a system or library call; e.g., with option 'ttl=valuecq the CWsetsockopt(fd, SOL_IP, IP_TTL, value,\r\nsizeof(int)) call is applied. Other options set internal socat variables that are used during data transfer; e.g., 'crnlcq\r\ncauses explicit character conversions. A few options have more complex implementations; e.g., su-d (substuser-delayed) inquires some user and group infos, stores them, and applies them later after a possible CWchroot() call.\r\nIf multiple options are given to an address, their sequence in the address specification has (almost) no effect on the\r\nsequence of their execution/application. Instead, socat has built in an option phase model that tries to bring the\r\noptions in a useful order. Some options exist in different forms (e.g., unlink, unlink-early, unlink-late) to control the\r\ntime of their execution.\r\nIf the same option is specified more than once within one address specification, with equal or different values, the\r\neffect depends on the kind of option. Options resulting in function calls like CWsetsockopt() cause multiple\r\ninvocations. With options that set parameters for a required call like CWopen() or set internal flags, the value of the\r\nlast option occurrence is effective.\r\nThe existence or semantics of many options are system dependent. Socat usually does NOT try to emulate missing\r\nlibc or kernel features, it just provides an interface to the underlying system. So, if an operating system lacks a\r\nfeature, the related option is simply not available on this platform.\r\nThe following paragraphs introduce just the more common address options. For a more comprehensive reference\r\nand to find information about canonical option names, alias names, option phases, and platforms see file xio.help.\r\nFD option group\r\nThis option group contains options that are applied to a UN*X style file descriptor, no matter how it was generated.\r\nBecause all current socat address types are file descriptor based, these options may be applied to any address.\r\nNote: Some of these options are also member of another option group, that provides an other, non-fd based\r\nmechanism. For these options, it depends on the actual address type and its option groups which mechanism is used.\r\nThe second, non-fd based mechanism is prioritized.\r\nCWcloexec=\u003cbool\u003e\r\nSets the CWFD_CLOEXEC flag with the CWfcntl() system call to value \u003cbool\u003e. If set, the file descriptor is\r\nclosed on CWexec() family function calls. Socat internally handles this flag for the fds it controls, so in most\r\ncases there will be no need to apply this option.\r\nCWsetlk\r\nTries to set a discretionary write lock to the whole file using the CWfcntl(fd, F_SETLK, ...) system call. If\r\nthe file is already locked, this call results in an error. On Linux, when the file permissions for group are\r\ndqSdq (g-x,g+s), and the file system is locally mounted with the dqmanddq option, the lock is mandatory, i.e.\r\nprevents other processes from opening the file.\r\nCWsetlkw\r\nhttps://linux.die.net/man/1/socat\r\nPage 16 of 48\n\nTries to set a discretionary waiting write lock to the whole file using the CWfcntl(fd, F_SETLKW, ...) system\r\ncall. If the file is already locked, this call blocks. See option setlk for information about making this lock\r\nmandatory.\r\nCWsetlk-rd\r\nTries to set a discretionary read lock to the whole file using the CWfcntl(fd, F_SETLK, ...) system call. If the\r\nfile is already write locked, this call results in an error. See option setlk for information about making this\r\nlock mandatory.\r\nCWsetlkw-rd\r\nTries to set a discretionary waiting read lock to the whole file using the CWfcntl(fd, F_SETLKW, ...) system\r\ncall. If the file is already write locked, this call blocks. See option setlk for information about making this\r\nlock mandatory.\r\nCWflock-ex\r\nTries to set a blocking exclusive advisory lock to the file using the CWflock(fd, LOCK_EX) system call.\r\nSocat hangs in this call if the file is locked by another process.\r\nCWflock-ex-nb\r\nTries to set a nonblocking exclusive advisory lock to the file using the CWflock(fd, LOCK_EX|LOCK_NB)\r\nsystem call. If the file is already locked, this option results in an error.\r\nCWflock-sh\r\nTries to set a blocking shared advisory lock to the file using the CWflock(fd, LOCK_SH) system call. Socat\r\nhangs in this call if the file is locked by another process.\r\nCWflock-sh-nb\r\nTries to set a nonblocking shared advisory lock to the file using the CWflock(fd, LOCK_SH|LOCK_NB)\r\nsystem call. If the file is already locked, this option results in an error.\r\nCWlock\r\nSets a blocking lock on the file. Uses the setlk or flock mechanism depending on availability on the\r\nparticular platform. If both are available, the POSIX variant (setlkw) is used.\r\nCWuser=\u003cuser\u003e\r\nSets the \u003cuser\u003e (owner) of the stream. If the address is member of the NAMED option group, socat uses the\r\nCWchown() system call after opening the file or binding to the UNIX domain socket (race condition!).\r\nWithout filesystem entry, socat sets the user of the stream using the CWfchown() system call. These calls\r\nmight require root privilege.\r\nCWuser-late=\u003cuser\u003e\r\nSets the owner of the fd to \u003cuser\u003e with the CWfchown() system call after opening or connecting the channel.\r\nThis is useful only on file system entries.\r\nCWgroup=\u003cgroup\u003e\r\nSets the \u003cgroup\u003e of the stream. If the address is member of the NAMED option group, socat uses the\r\nCWchown() system call after opening the file or binding to the UNIX domain socket (race condition!).\r\nWithout filesystem entry, socat sets the group of the stream with the CWfchown() system call. These calls\r\nmight require group membership or root privilege.\r\nCWgroup-late=\u003cgroup\u003e\r\nSets the group of the fd to \u003cgroup\u003e with the CWfchown() system call after opening or connecting the\r\nchannel. This is useful only on file system entries.\r\nCWmode=\u003cmode\u003e\r\nhttps://linux.die.net/man/1/socat\r\nPage 17 of 48\n\nSets the \u003cmode\u003e [mode_t] (permissions) of the stream. If the address is member of the NAMED option\r\ngroup and uses the CWopen() or CWcreat() call, the mode is applied with these. If the address is member of\r\nthe NAMED option group without using these system calls, socat uses the CWchmod() system call after\r\nopening the filesystem entry or binding to the UNIX domain socket (race condition!). Otherwise, socat sets\r\nthe mode of the stream using CWfchmod() . These calls might require ownership or root privilege.\r\nCWperm-late=\u003cmode\u003e\r\nSets the permissions of the fd to value \u003cmode\u003e [mode_t] using the CWfchmod() system call after opening or\r\nconnecting the channel. This is useful only on file system entries.\r\nCWappend=\u003cbool\u003e\r\nAlways writes data to the actual end of file. If the address is member of the OPEN option group, socat uses\r\nthe CWO_APPEND flag with the CWopen() system call (example). Otherwise, socat applies the\r\nCWfcntl(fd, F_SETFL, O_APPEND) call.\r\nCWnonblock=\u003cbool\u003e\r\nTries to open or use file in nonblocking mode. Its only effects are that the CWconnect() call of TCP\r\naddresses does not block, and that opening a named pipe for reading does not block. If the address is member\r\nof the OPEN option group, socat uses the CWO_NONBLOCK flag with the CWopen() system call.\r\nOtherwise, socat applies the CWfcntl(fd, F_SETFL, O_NONBLOCK) call.\r\nCWbinary\r\nOpens the file in binary mode to avoid implicit line terminator conversions (Cygwin).\r\nCWtext\r\nOpens the file in text mode to force implicit line terminator conversions (Cygwin).\r\nCWnoinherit\r\nDoes not keep this file open in a spawned process (Cygwin).\r\nCWcool-write\r\nTakes it easy when write fails with EPIPE or ECONNRESET and logs the message with notice level instead\r\nof error. This prevents the log file from being filled with useless error messages when socat is used as a high\r\nvolume server or proxy where clients often abort the connection.\r\nThis option is experimental.\r\nCWend-close\r\nChanges the (address dependent) method of ending a connection to just close the file descriptors. This is\r\nuseful when the connection is to be reused by or shared with other processes (example).\r\nNormally, socket connections will be ended with CWshutdown(2) which terminates the socket even if it is\r\nshared by multiple processes. CWclose(2) dqunlinksdq the socket from the process but keeps it active as\r\nlong as there are still links from other processes.\r\nSimilarly, when an address of type EXEC or SYSTEM is ended, socat usually will explicitely kill the sub\r\nprocess. With this option, it will just close the file descriptors.\r\nCWshut-none\r\nChanges the (address dependent) method of shutting down the write part of a connection to not do anything.\r\nCWshut-down\r\nChanges the (address dependent) method of shutting down the write part of a connection to CWshutdown\\\r\n(fd, SHUT_WR). Is only useful with sockets.\r\nCWshut-close\r\nChanges the (address dependent) method of shutting down the write part of a connection to CWclose\\(fd).\r\nhttps://linux.die.net/man/1/socat\r\nPage 18 of 48\n\nCWshut-null\r\nWhen one address indicates EOF, socat will send a zero sized packet to the write channel of the other\r\naddress to transfer the EOF condition. This is useful with UDP and other datagram protocols. Has been\r\ntested against netcat and socat with option null-eof.\r\nCWnull-eof\r\nNormally socat will ignore empty (zero size payload) packets arriving on datagram sockets, so it survives\r\nport scans. With this option socat interprets empty datagram packets as EOF indicator (see shut-null).\r\nCWioctl-void=\u003crequest\u003e\r\nCalls CWioctl() with the request value as second argument and NULL as third argument. This option allows\r\nto utilize ioctls that are not explicitely implemented in socat.\r\nCWioctl-int=\u003crequest\u003e:\u003cvalue\u003e\r\nCalls CWioctl() with the request value as second argument and the integer value as third argument.\r\nCWioctl-intp=\u003crequest\u003e:\u003cvalue\u003e\r\nCalls CWioctl() with the request value as second argument and a pointer to the integer value as third\r\nargument.\r\nCWioctl-bin=\u003crequest\u003e:\u003cvalue\u003e\r\nCalls CWioctl() with the request value as second argument and a pointer to the given data value as third\r\nargument. This data must be specified in \u003cdalan\u003e form.\r\nCWioctl-string=\u003crequest\u003e:\u003cvalue\u003e\r\nCalls CWioctl() with the request value as second argument and a pointer to the given string as third\r\nargument. \u003cdalan\u003e form.\r\nNAMED option group\r\nThese options work on file system entries.\r\nSee also options user, group, and mode.\r\nCWuser-early=\u003cuser\u003e\r\nChanges the \u003cuser\u003e (owner) of the file system entry before accessing it, using the CWchown() system call.\r\nThis call might require root privilege.\r\nCWgroup-early=\u003cgroup\u003e\r\nChanges the \u003cgroup\u003e of the file system entry before accessing it, using the CWchown() system call. This\r\ncall might require group membership or root privilege.\r\nCWperm-early=\u003cmode\u003e\r\nChanges the \u003cmode\u003e [mode_t] of the file system entry before accessing it, using the CWchmod() system\r\ncall. This call might require ownership or root privilege.\r\nCWumask=\u003cmode\u003e\r\nSets the umask of the process to \u003cmode\u003e [mode_t] before accessing the file system entry (useful with UNIX\r\ndomain sockets!). This call might affect all further operations of the socat process!\r\nCWunlink-early\r\nUnlinks (removes) the file before opening it and even before applying user-early etc.\r\nCWunlink\r\nUnlinks (removes) the file before accessing it, but after user-early etc.\r\nCWunlink-late\r\nhttps://linux.die.net/man/1/socat\r\nPage 19 of 48\n\nUnlinks (removes) the file after opening it to make it inaccessible for other processes after a short race\r\ncondition.\r\nCWunlink-close\r\nRemoves the addresses file system entry when closing the address. For named pipes, listening unix domain\r\nsockets, and the symbolic links of pty addresses, the default is 1; for created files, opened files, generic\r\nopened files, and client unix domain sockets the default is 0.\r\nOPEN option group\r\nThe OPEN group options allow to set flags with the CWopen() system call. E.g., option 'creatcq sets the\r\nCWO_CREAT flag.\r\nSee also options append and nonblock.\r\nCWcreat=\u003cbool\u003e\r\nCreates the file if it does not exist (example).\r\nCWdsync=\u003cbool\u003e\r\nBlocks CWwrite() calls until metainfo is physically written to media.\r\nCWexcl=\u003cbool\u003e\r\nWith option creat, if file exists this is an error.\r\nCWlargefile=\u003cbool\u003e\r\nOn 32 bit systems, allows a file larger than 2^31 bytes.\r\nCWnoatime\r\nSets the O_NOATIME options, so reads do not change the access timestamp.\r\nCWnoctty=\u003cbool\u003e\r\nDoes not make this file the controlling terminal.\r\nCWnofollow=\u003cbool\u003e\r\nDoes not follow symbolic links.\r\nCWnshare=\u003cbool\u003e\r\nDoes not allow to share this file with other processes.\r\nCWrshare=\u003cbool\u003e\r\nDoes not allow other processes to open this file for writing.\r\nCWrsync=\u003cbool\u003e\r\nBlocks CWwrite() until metainfo is physically written to media.\r\nCWsync=\u003cbool\u003e\r\nBlocks CWwrite() until data is physically written to media.\r\nCWrdonly=\u003cbool\u003e\r\nOpens the file for reading only.\r\nCWwronly=\u003cbool\u003e\r\nOpens the file for writing only.\r\nCWtrunc\r\nTruncates the file to size 0 during opening it.\r\nREG and BLK option group\r\nhttps://linux.die.net/man/1/socat\r\nPage 20 of 48\n\nThese options are usually applied to a UN*X file descriptor, but their semantics make sense only on a file\r\nsupporting random access.\r\nCWseek=\u003coffset\u003e\r\nApplies the CWlseek(fd, \u003coffset\u003e, SEEK_SET) (or CWlseek64 ) system call, thus positioning the file\r\npointer absolutely to \u003coffset\u003e [off_t or off64_t]. Please note that a missing value defaults to 1, not 0.\r\nCWseek-cur=\u003coffset\u003e\r\nApplies the CWlseek(fd, \u003coffset\u003e, SEEK_CUR) (or CWlseek64 ) system call, thus positioning the file\r\npointer \u003coffset\u003e [off_t or off64_t] bytes relatively to its current position (which is usually 0). Please note that\r\na missing value defaults to 1, not 0.\r\nCWseek-end=\u003coffset\u003e\r\nApplies the CWlseek(fd, \u003coffset\u003e, SEEK_END) (or CWlseek64 ) system call, thus positioning the file\r\npointer \u003coffset\u003e [off_t or off64_t] bytes relatively to the files current end. Please note that a missing value\r\ndefaults to 1, not 0.\r\nCWftruncate=\u003coffset\u003e\r\nApplies the CWftruncate(fd, \u003coffset\u003e) (or CWftruncate64 if available) system call, thus truncating the file at\r\nthe position \u003coffset\u003e [off_t or off64_t]. Please note that a missing value defaults to 1, not 0.\r\nCWsecrm=\u003cbool\u003e\r\nCWunrm=\u003cbool\u003e\r\nCWcompr=\u003cbool\u003e\r\nCWext2-sync=\u003cbool\u003e\r\nCWimmutable=\u003cbool\u003e\r\nCWext2-append=\u003cbool\u003e\r\nCWnodump=\u003cbool\u003e\r\nCWext2-noatime=\u003cbool\u003e\r\nCWjournal-data=\u003cbool\u003e\r\nCWnotail=\u003cbool\u003e\r\nCWdirsync=\u003cbool\u003e\r\nThese options change non standard file attributes on operating systems and file systems that support these\r\nfeatures, like Linux with ext2fs, ext3fs, or reiserfs. See man 1 chattr for information on these options. Please\r\nnote that there might be a race condition between creating the file and applying these options.\r\nPROCESS option group\r\nOptions of this group change the process properties instead of just affecting one data channel. For EXEC and\r\nSYSTEM addresses and for LISTEN and CONNECT type addresses with option FORK, these options apply to the\r\nchild processes instead of the main socat process.\r\nCWchroot=\u003cdirectory\u003e\r\nPerforms a CWchroot() operation to \u003cdirectory\u003e after processing the address (example). This call might\r\nrequire root privilege.\r\nCWchroot-early=\u003cdirectory\u003e\r\nPerforms a CWchroot() operation to \u003cdirectory\u003e before opening the address. This call might require root\r\nprivilege.\r\nhttps://linux.die.net/man/1/socat\r\nPage 21 of 48\n\nCWsetgid=\u003cgroup\u003e\r\nChanges the primary \u003cgroup\u003e of the process after processing the address. This call might require root\r\nprivilege. Please note that this option does not drop other group related privileges.\r\nCWsetgid-early=\u003cgroup\u003e\r\nLike setgit but is performed before opening the address.\r\nCWsetuid=\u003cuser\u003e\r\nChanges the \u003cuser\u003e (owner) of the process after processing the address. This call might require root\r\nprivilege. Please note that this option does not drop group related privileges. Check if option su better fits\r\nyour needs.\r\nCWsetuid-early=\u003cuser\u003e\r\nLike setuid but is performed before opening the address.\r\nCWsu=\u003cuser\u003e\r\nChanges the \u003cuser\u003e (owner) and groups of the process after processing the address (example). This call\r\nmight require root privilege.\r\nCWsu-d=\u003cuser\u003e\r\nShort name for CWsubstuser-delayed. Changes the \u003cuser\u003e (owner) and groups of the process after\r\nprocessing the address (example). The user and his groups are retrieved before a possible CWchroot() . This\r\ncall might require root privilege.\r\nCWsetpgid=\u003cpid_t\u003e\r\nMakes the process a member of the specified process group \u003cpid_t\u003e. If no value is given, or if the value is 0\r\nor 1, the process becomes leader of a new process group.\r\nCWsetsid\r\nMakes the process the leader of a new session (example).\r\nREADLINE option group\r\nThese options apply to the readline address type.\r\nCWhistory=\u003cfilename\u003e\r\nReads and writes history from/to \u003cfilename\u003e (example).\r\nCWnoprompt\r\nSince version 1.4.0, socat per default tries to determine a prompt - that is then passed to the readline call - by\r\nremembering the last incomplete line of the output. With this option, socat does not pass a prompt to\r\nreadline, so it begins line editing in the first column of the terminal.\r\nCWnoecho=\u003cpattern\u003e\r\nSpecifies a regular pattern for a prompt that prevents the following input line from being displayed on the\r\nscreen and from being added to the history. The prompt is defined as the text that was output to the readline\r\naddress after the lastest newline character and before an input character was typed. The pattern is a regular\r\nexpression, e.g. dq^[Pp]assword:.*$dq or dq([Uu]ser:|[Pp]assword:)dq. See regex\\(7) for details. (example)\r\nCWprompt=\u003cstring\u003e\r\nPasses the string as prompt to the readline function. readline prints this prompt when stepping through the\r\nhistory. If this string matches a constant prompt issued by an interactive program on the other socat address,\r\nconsistent look and feel can be archieved.\r\nhttps://linux.die.net/man/1/socat\r\nPage 22 of 48\n\nAPPLICATION option group\r\nThis group contains options that work at data level. Note that these options only apply to the dqrawdq data\r\ntransferred by socat, but not to protocol data used by addresses like PROXY.\r\nCWcr\r\nConverts the default line termination character NL (cq\\ncq, 0x0a) to/from CR (cq\\rcq, 0x0d) when\r\nwriting/reading on this channel.\r\nCWcrnl\r\nConverts the default line termination character NL (cq\\ncq, 0x0a) to/from CRNL (dq\\r\\ndq, 0x0d0a) when\r\nwriting/reading on this channel (example). Note: socat simply strips all CR characters.\r\nCWignoreeof\r\nWhen EOF occurs on this channel, socat ignores it and tries to read more data (like dqtail -fdq) (example).\r\nCWreadbytes=\u003cbytes\u003e\r\nsocat reads only so many bytes from this address (the address provides only so many bytes for transfer and\r\npretends to be at EOF afterwards). Must be greater than 0.\r\nCWlockfile=\u003cfilename\u003e\r\nIf lockfile exists, exits with error. If lockfile does not exist, creates it and continues, unlinks lockfile on exit.\r\nCWwaitlock=\u003cfilename\u003e\r\nIf lockfile exists, waits until it disappears. When lockfile does not exist, creates it and continues, unlinks\r\nlockfile on exit.\r\nCWescape=\u003cint\u003e\r\nSpecifies the numeric code of a character that triggers EOF on the input stream. It is useful with a terminal in\r\nraw mode (example).\r\nSOCKET option group\r\nThese options are intended for all kinds of sockets, e.g. IP or UNIX domain. Most are applied with a\r\nCWsetsockopt() call.\r\nCWbind=\u003csockname\u003e\r\nBinds the socket to the given socket address using the CWbind() system call. The form of \u003csockname\u003e is\r\nsocket domain dependent: IP4 and IP6 allow the form [hostname|hostaddress][:(service|port)] (example),\r\nUNIX domain sockets require \u003cfilename\u003e.\r\nCWconnect-timeout=\u003cseconds\u003e\r\nAbort the connection attempt after \u003cseconds\u003e [timeval] with error status.\r\nCWso-bindtodevice=\u003cinterface\u003e\r\nBinds the socket to the given \u003cinterface\u003e. This option might require root privilege.\r\nCWbroadcast\r\nFor datagram sockets, allows sending to broadcast addresses and receiving packets addressed to broadcast\r\naddresses.\r\nCWdebug\r\nEnables socket debugging.\r\nCWdontroute\r\nOnly communicates with directly connected peers, does not use routers.\r\nhttps://linux.die.net/man/1/socat\r\nPage 23 of 48\n\nCWkeepalive\r\nEnables sending keepalives on the socket.\r\nCWlinger=\u003cseconds\u003e\r\nBlocks CWshutdown() or CWclose() until data transfers have finished or the given timeout [int] expired.\r\nCWoobinline\r\nPlaces out-of-band data in the input data stream.\r\nCWpriority=\u003cpriority\u003e\r\nSets the protocol defined \u003cpriority\u003e [\u003cint\u003e] for outgoing packets.\r\nCWrcvbuf=\u003cbytes\u003e\r\nSets the size of the receive buffer after the CWsocket() call to \u003cbytes\u003e [int]. With TCP sockets, this value\r\ncorresponds to the socketcqs maximal window size.\r\nCWrcvbuf-late=\u003cbytes\u003e\r\nSets the size of the receive buffer when the socket is already connected to \u003cbytes\u003e [int]. With TCP sockets,\r\nthis value corresponds to the socketcqs maximal window size.\r\nCWrcvlowat=\u003cbytes\u003e\r\nSpecifies the minimum number of received bytes [int] until the socket layer will pass the buffered data to\r\nsocat.\r\nCWrcvtimeo=\u003cseconds\u003e\r\nSets the receive timeout [timeval].\r\nCWreuseaddr\r\nAllows other sockets to bind to an address even if parts of it (e.g. the local port) are already in use by socat\r\n(example).\r\nCWsndbuf=\u003cbytes\u003e\r\nSets the size of the send buffer after the CWsocket() call to \u003cbytes\u003e [int].\r\nCWsndbuf-late=\u003cbytes\u003e\r\nSets the size of the send buffer when the socket is connected to \u003cbytes\u003e [int].\r\nCWsndlowat=\u003cbytes\u003e\r\nSpecifies the minimum number of bytes in the send buffer until the socket layer will send the data to \u003cbytes\u003e\r\n[int].\r\nCWsndtimeo=\u003cseconds\u003e\r\nSets the send timeout to seconds [timeval].\r\nCWpf=\u003cstring\u003e\r\nForces the use of the specified IP version or protocol. \u003cstring\u003e can be something like dqip4dq or dqip6dq.\r\nThe resulting value is used as first argument to the CWsocket() or CWsocketpair() calls. This option affects\r\naddress resolution and the required syntax of bind and range options.\r\nCWtype=\u003ctype\u003e\r\nSets the type of the socket, specified as second argument to the CWsocket() or CWsocketpair() calls, to\r\n\u003ctype\u003e [int]. Address resolution is not affected by this option. Under Linux, 1 means stream oriented socket,\r\n2 means datagram socket, and 3 means raw socket.\r\nCWprototype\r\nSets the protocol of the socket, specified as third argument to the CWsocket() or CWsocketpair() calls, to\r\n\u003cprototype\u003e [int]. Address resolution is not affected by this option. 6 means TCP, 17 means UDP.\r\nCWso-timestamp\r\nhttps://linux.die.net/man/1/socat\r\nPage 24 of 48\n\nSets the SO_TIMESTAMP socket option. This enables receiving and logging of timestamp ancillary\r\nmessages.\r\nCWsetsockopt-int=\u003clevel\u003e:\u003coptname\u003e:\u003coptval\u003e\r\nInvokes CWsetsockopt() for the socket with the given parameters. CWlevel [int] is used as second argument\r\nto CWsetsockopt() and specifies the layer, e.g. SOL_TCP for TCP (6 on Linux), or SOL_SOCKET for the\r\nsocket layer (1 on Linux). CWoptname [int] is the third argument to CWsetsockopt() and tells which socket\r\noption is to be set. For the actual numbers you might have to look up the appropriate include files of your\r\nsystem. The 4th CWsetsockopt() parameter, CWvalue [int], is passed to the function per pointer, and for the\r\nlength parameter sizeof\\(int) is taken implicitely.\r\nCWsetsockopt-bin=\u003clevel\u003e:\u003coptname\u003e:\u003coptval\u003e\r\nLike CWsetsockopt-int, but \u003coptval\u003e must be provided in dalan format and specifies an arbitrary sequence\r\nof bytes; the length parameter is automatically derived from the data.\r\nCWsetsockopt-string=\u003clevel\u003e:\u003coptname\u003e:\u003coptval\u003e\r\nLike CWsetsockopt-int, but \u003coptval\u003e must be a string. This string is passed to the function with trailing null\r\ncharacter, and the length parameter is automatically derived from the data.\r\nUNIX option group\r\nThese options apply to UNIX domain based addresses.\r\nCWunix-tightsocklen=[0|1]\r\nOn socket operations, pass a socket address length that does not include the whole CWstruct sockaddr_un\r\nrecord but (besides other components) only the relevant part of the filename or abstract string. Default is 1.\r\nIP4 and IP6 option groups\r\nThese options can be used with IPv4 and IPv6 based sockets.\r\nCWtos=\u003ctos\u003e\r\nSets the TOS (type of service) field of outgoing packets to \u003ctos\u003e [byte] (see RFC 791).\r\nCWttl=\u003cttl\u003e\r\nSets the TTL (time to live) field of outgoing packets to \u003cttl\u003e [byte].\r\nCWip-options=\u003cdata\u003e\r\nSets IP options like source routing. Must be given in binary form, recommended format is a leading dqxdq\r\nfollowed by an even number of hex digits. This option may be used multiple times, data are appended. E.g.,\r\nto connect to host 10.0.0.1 via some gateway using a loose source route, use the gateway as address\r\nparameter and set a loose source route using the option CWip-options=x8307040a000001 .\r\nIP options are defined in RFC 791.\r\nCWmtudiscover=\u003c0|1|2\u003e\r\nTakes 0, 1, 2 to never, want, or always use path MTU discover on this socket.\r\nCWip-pktinfo\r\nSets the IP_PKTINFO socket option. This enables receiving and logging of ancillary messages containing\r\ndestination address and interface (Linux) (example).\r\nCWip-recverr\r\nhttps://linux.die.net/man/1/socat\r\nPage 25 of 48\n\nSets the IP_RECVERR socket option. This enables receiving and logging of ancillary messages containing\r\ndetailled error information.\r\nCWip-recvopts\r\nSets the IP_RECVOPTS socket option. This enables receiving and logging of IP options ancillary messages\r\n(Linux, *BSD).\r\nCWip-recvtos\r\nSets the IP_RECVTOS socket option. This enables receiving and logging of TOS (type of service) ancillary\r\nmessages (Linux).\r\nCWip-recvttl\r\nSets the IP_RECVTTL socket option. This enables receiving and logging of TTL (time to live) ancillary\r\nmessages (Linux, *BSD).\r\nCWip-recvdstaddr\r\nSets the IP_RECVDSTADDR socket option. This enables receiving and logging of ancillary messages\r\ncontaining destination address (*BSD) (example).\r\nCWip-recvif\r\nSets the IP_RECVIF socket option. This enables receiving and logging of interface ancillary messages\r\n(*BSD) (example).\r\nCWip-add-membership=\u003cmulticast-address:interface-address\u003e\r\nCWip-add-membership=\u003cmulticast-address:interface-name\u003e\r\nCWip-add-membership=\u003cmulticast-address:interface-index\u003e\r\nCWip-add-membership=\u003cmulticast-address:interface-address:interface-name\u003e\r\nCWip-add-membership=\u003cmulticast-address:interface-address:interface-index\u003e\r\nMakes the socket member of the specified multicast group. This is currently only implemented for IPv4. The\r\noption takes the IP address of the multicast group and info about the desired network interface. The most\r\ncommon syntax is the first one, while the others are only available on systems that provide CWstruct mreqn\r\n(Linux).\r\nThe indices of active network interfaces can be shown using the utility procan.\r\nCWip-multicast-if=\u003chostname\u003e\r\nSpecifies hostname or address of the network interface to be used for multicast traffic.\r\nCWip-multicast-loop=\u003cbool\u003e\r\nSpecifies if outgoing multicast traffic should loop back to the interface.\r\nCWip-multicast-ttl=\u003cbyte\u003e\r\nSets the TTL used for outgoing multicast traffic. Default is 1.\r\nCWres-debug\r\nCWres-aaonly\r\nCWres-usevc\r\nCWres-primary\r\nCWres-igntc\r\nCWres-recurse\r\nCWres-defnames\r\nCWres-stayopen\r\nCWres-dnsrch\r\nhttps://linux.die.net/man/1/socat\r\nPage 26 of 48\n\nThese options set the corresponding resolver (name resolution) option flags. Append dq=0dq to clear a\r\ndefault option. See man resolver\\(5) for more information on these options. Note: these options are valid\r\nonly for the address they are applied to.\r\nIP6 option group\r\nThese options can only be used on IPv6 based sockets. See IP options for options that can be applied to both IPv4\r\nand IPv6 sockets.\r\nCWipv6only=\u003cbool\u003e\r\nSets the IPV6_V6ONLY socket option. If 0, the TCP stack will also accept connections using IPv4 protocol\r\non the same port. The default is system dependent.\r\nCWipv6-recvdstopts\r\nSets the IPV6_RECVDSTOPTS socket option. This enables receiving and logging of ancillary messages\r\ncontaining the destination options.\r\nCWipv6-recvhoplimit\r\nSets the IPV6_RECVHOPLIMIT socket option. This enables receiving and logging of ancillary messages\r\ncontaining the hoplimit.\r\nCWipv6-recvhopopts\r\nSets the IPV6_RECVHOPOPTS socket option. This enables receiving and logging of ancillary messages\r\ncontaining the hop options.\r\nCWipv6-recvpktinfo\r\nSets the IPV6_RECVPKTINFO socket option. This enables receiving and logging of ancillary messages\r\ncontaining destination address and interface.\r\nCWipv6-unicast-hops=link(TYPE_INT)(\u003cint\u003e)\r\nSets the IPV6_UNICAST_HOPS socket option. This sets the hop count limit (TTL) for outgoing unicast\r\npackets.\r\nCWipv6-recvrthdr\r\nSets the IPV6_RECVRTHDR socket option. This enables receiving and logging of ancillary messages\r\ncontaining routing information.\r\nCWipv6-tclass\r\nSets the IPV6_TCLASS socket option. This sets the transfer class of outgoing packets.\r\nCWipv6-recvtclass\r\nSets the IPV6_RECVTCLASS socket option. This enables receiving and logging of ancillary messages\r\ncontaining the transfer class.\r\nTCP option group\r\nThese options may be applied to TCP sockets. They work by invoking CWsetsockopt() with the appropriate\r\nparameters.\r\nCWcork\r\nDoesncqt send packets smaller than MSS (maximal segment size).\r\nCWdefer-accept\r\nWhile listening, accepts connections only when data from the peer arrived.\r\nCWkeepcnt=\u003ccount\u003e\r\nhttps://linux.die.net/man/1/socat\r\nPage 27 of 48\n\nSets the number of keepalives before shutting down the socket to \u003ccount\u003e [int].\r\nCWkeepidle=\u003cseconds\u003e\r\nSets the idle time before sending the first keepalive to \u003cseconds\u003e [int].\r\nCWkeepintvl=\u003cseconds\u003e\r\nSets the interval between two keepalives to \u003cseconds\u003e [int].\r\nCWlinger2=\u003cseconds\u003e\r\nSets the time to keep the socket in FIN-WAIT-2 state to \u003cseconds\u003e [int].\r\nCWmss=\u003cbytes\u003e\r\nSets the MSS (maximum segment size) after the CWsocket() call to \u003cbytes\u003e [int]. This value is then\r\nproposed to the peer with the SYN or SYN/ACK packet (example).\r\nCWmss-late=\u003cbytes\u003e\r\nSets the MSS of the socket after connection has been established to \u003cbytes\u003e [int].\r\nCWnodelay\r\nTurns off the Nagle algorithm for measuring the RTT (round trip time).\r\nCWrfc1323\r\nEnables RFC1323 TCP options: TCP window scale, round-trip time measurement (RTTM), and protect\r\nagainst wrapped sequence numbers (PAWS) (AIX).\r\nCWstdurg\r\nEnables RFC1122 compliant urgent pointer handling (AIX).\r\nCWsyncnt=\u003ccount\u003e\r\nSets the maximal number of SYN retransmits during connect to \u003ccount\u003e [int].\r\nCWmd5sig\r\nEnables generation of MD5 digests on the packets (FreeBSD).\r\nCWnoopt\r\nDisables use of TCP options (FreeBSD, MacOSX).\r\nCWnopush\r\nsets the TCP_NOPUSH socket option (FreeBSD, MacOSX).\r\nCWsack-disable\r\nDisables use the selective acknowledge feature (OpenBSD).\r\nCWsignature-enable\r\nEnables generation of MD5 digests on the packets (OpenBSD).\r\nCWabort-threshold=\u003cmilliseconds\u003e\r\nSets the time to wait for an answer of the peer on an established connection (HP-UX).\r\nCWconn-abort-threshold=\u003cmilliseconds\u003e\r\nSets the time to wait for an answer of the server during the initial connect (HP-UX).\r\nCWkeepinit\r\nSets the time to wait for an answer of the server during connect\\() before giving up. Value in half seconds,\r\ndefault is 150 (75s) (Tru64).\r\nCWpaws\r\nEnables the dqprotect against wrapped sequence numbersdq feature (Tru64).\r\nCWsackena\r\nEnables selective acknowledge (Tru64).\r\nCWtsoptena\r\nhttps://linux.die.net/man/1/socat\r\nPage 28 of 48\n\nEnables the time stamp option that allows RTT recalculation on existing connections (Tru64).\r\nSCTP option group\r\nThese options may be applied to SCTP stream sockets.\r\nCWsctp-nodelay\r\nSets the SCTP_NODELAY socket option that disables the Nagle algorithm.\r\nCWsctp-maxseg=\u003cbytes\u003e\r\nSets the SCTP_MAXSEG socket option to \u003cbytes\u003e [int]. This value is then proposed to the peer with the\r\nSYN or SYN/ACK packet.\r\nUDP, TCP, and SCTP option groups\r\nHere we find options that are related to the network port mechanism and thus can be used with UDP, TCP, and\r\nSCTP client and server addresses.\r\nCWsourceport=\u003cport\u003e\r\nFor outgoing (client) TCP and UDP connections, it sets the source \u003cport\u003e using an extra CWbind() call. With\r\nTCP or UDP listen addresses, socat immediately shuts down the connection if the client does not use this\r\nsourceport (example).\r\nCWlowport\r\nOutgoing (client) TCP and UDP connections with this option use an unused random source port between 640\r\nand 1023 incl. On UNIX class operating systems, this requires root privilege, and thus indicates that the\r\nclient process is authorized by local root. TCP and UDP listen addresses with this option immediately shut\r\ndown the connection if the client does not use a sourceport \u003c= 1023. This mechanism can provide limited\r\nauthorization under some circumstances.\r\nSOCKS option group\r\nWhen using SOCKS type addresses, some socks specific options can be set.\r\nCWsocksport=\u003ctcp service\u003e\r\nOverrides the default dqsocksdq service or port 1080 for the socks server port with \u003cTCP service\u003e.\r\nCWsocksuser=\u003cuser\u003e\r\nSends the \u003cuser\u003e [string] in the username field to the socks server. Default is the actual user name\r\n($LOGNAME or $USER) (example).\r\nHTTP option group\r\nOptions that can be provided with HTTP type addresses. The only HTTP address currently implemented is proxy-connect.\r\nCWproxyport=\u003cTCP service\u003e\r\nOverrides the default HTTP proxy port 8080 with \u003cTCP service\u003e.\r\nCWignorecr\r\nhttps://linux.die.net/man/1/socat\r\nPage 29 of 48\n\nThe HTTP protocol requires the use of CR+NL as line terminator. When a proxy server violates this\r\nstandard, socat might not understand its answer. This option directs socat to interprete NL as line terminator\r\nand to ignore CR in the answer. Nevertheless, socat sends CR+NL to the proxy.\r\nCWproxyauth=\u003cusername\u003e:\u003cpassword\u003e\r\nProvide dqbasicdq authentication to the proxy server. The argument to the option is used with a dqProxy-Authorization: Basedq header in base64 encoded form.\r\nNote: username and password are visible for every user on the local machine in the process list; username\r\nand password are transferred to the proxy server unencrypted (base64 encoded) and might be sniffed.\r\nCWresolve\r\nPer default, socat sends to the proxy a CONNECT request containing the target hostname. With this option,\r\nsocat resolves the hostname locally and sends the IP address. Please note that, according to RFC 2396, only\r\nname resolution to IPv4 addresses is implemented.\r\nRANGE option group\r\nThese options check if a connecting client should be granted access. They can be applied to listening and receiving\r\nnetwork sockets. tcp-wrappers options fall into this group.\r\nCWrange=\u003caddress-range\u003e\r\nAfter accepting a connection, tests if the peer is within range. For IPv4 addresses, address-range takes the\r\nform address/bits, e.g. 10.0.0.0/8, or address:mask, e.g. 10.0.0.0:255.0.0.0 (example); for IPv6, it is [ip6-\r\naddress/bits], e.g. [::1/128]. If the client address does not match, socat issues a warning and keeps\r\nlistening/receiving.\r\nCWtcpwrap[=\u003cname\u003e]\r\nUses Wietse Venemacqs libwrap (tcpd) library to determine if the client is allowed to connect. The\r\nconfiguration files are /etc/hosts.allow and /etc/hosts.deny per default, see dqman 5 hosts_accessdq for more\r\ninformation. The optional \u003cname\u003e (type string) is passed to the wrapper functions as daemon process name\r\n(example). If omitted, the basename of socats invocation (argv[0]) is passed. If both tcpwrap and range\r\noptions are applied to an address, both conditions must be fulfilled to allow the connection.\r\nCWallow-table=\u003cfilename\u003e\r\nTakes the specified file instead of /etc/hosts.allow.\r\nCWdeny-table=\u003cfilename\u003e\r\nTakes the specified file instead of /etc/hosts.deny.\r\nCWtcpwrap-etc=\u003cdirectoryname\u003e\r\nLooks for hosts.allow and hosts.deny in the specified directory. Is overridden by options hosts-allow and\r\nhosts-deny.\r\nLISTEN option group\r\nOptions specific to listening sockets.\r\nCWbacklog=\u003ccount\u003e\r\nSets the backlog value passed with the CWlisten() system call to \u003ccount\u003e [int]. Default is 5.\r\nCWmax-children=\u003ccount\u003e\r\nLimits the number of concurrent child processes [int]. Default is no limit.\r\nhttps://linux.die.net/man/1/socat\r\nPage 30 of 48\n\nCHILD option group\r\nOptions for addresses with multiple connections via child processes.\r\nCWfork\r\nAfter establishing a connection, handles its channel in a child process and keeps the parent process\r\nattempting to produce more connections, either by listening or by connecting in a loop (example).\r\nSSL-CONNECT and SSL-LISTEN differ in when they actually fork off the child: SSL-LISTEN forks before\r\nthe SSL handshake, while SSL-CONNECT forks afterwards. RETRY and FOREVER options are not\r\ninherited by the child process.\r\nEXEC option group\r\nOptions for addresses that invoke a program.\r\nCWpath=\u003cstring\u003e\r\nOverrides the PATH environment variable for searching the program with \u003cstring\u003e. This CW$PATH value is\r\neffective in the child process too.\r\nCWlogin\r\nPrefixes CWargv[0] for the CWexecvp() call with cq-cq, thus making a shell behave as login shell.\r\nFORK option group\r\nEXEC or SYSTEM addresses invoke a program using a child process and transfer data between socat and the\r\nprogram. The interprocess communication mechanism can be influenced with the following options. Per default, a\r\nCWsocketpair() is created and assigned to stdin and stdout of the child process, while stderr is inherited from the\r\nsocat process, and the child process uses file descriptors 0 and 1 for communicating with the main socat process.\r\nCWnofork\r\nDoes not fork a subprocess for executing the program, instead calls execvp\\() or system\\() directly from the\r\nactual socat instance. This avoids the overhead of another process between the program and its peer, but\r\nintroduces a lot of restrictions:\r\no\r\nthis option can only be applied to the second socat address.\r\no\r\nit cannot be applied to a part of a dual address.\r\no\r\nthe first socat address cannot be OPENSSL or READLINE\r\no\r\nsocat options -b, -t, -D, -l, -v, -x become useless\r\no\r\nfor both addresses, options ignoreeof, cr, and crnl become useless\r\no\r\nfor the second address (the one with option nofork), options append, cloexec, flock, user, group, mode,\r\nnonblock, perm-late, setlk, and setpgid cannot be applied. Some of these could be used on the first address\r\nthough.\r\nhttps://linux.die.net/man/1/socat\r\nPage 31 of 48\n\nCWpipes\r\nCreates a pair of unnamed pipes for interprocess communication instead of a socket pair.\r\nCWopenpty\r\nEstablishes communication with the sub process using a pseudo terminal created with CWopenpty() instead\r\nof the default (socketpair or ptmx).\r\nCWptmx\r\nEstablishes communication with the sub process using a pseudo terminal created by opening /dev/ptmx or\r\n/dev/ptc instead of the default (socketpair).\r\nCWpty\r\nEstablishes communication with the sub process using a pseudo terminal instead of a socket pair. Creates the\r\npty with an available mechanism. If openpty and ptmx are both available, it uses ptmx because this is POSIX\r\ncompliant (example).\r\nCWctty\r\nMakes the pty the controlling tty of the sub process (example).\r\nCWstderr\r\nDirects stderr of the sub process to its output channel by making stderr a CWdup() of stdout (example).\r\nCWfdin=\u003cfdnum\u003e\r\nAssigns the sub processes input channel to its file descriptor \u003cfdnum\u003e instead of stdin (0). The program\r\nstarted from the subprocess has to use this fd for reading data from socat (example).\r\nCWfdout=\u003cfdnum\u003e\r\nAssigns the sub processes output channel to its file descriptor \u003cfdnum\u003e instead of stdout (1). The program\r\nstarted from the subprocess has to use this fd for writing data to socat (example).\r\nCWsighup, CWsigint, CWsigquit\r\nHas socat pass signals of this type to the sub process. If no address has this option, socat terminates on these\r\nsignals.\r\nTERMIOS option group\r\nFor addresses that work on a tty (e.g., stdio, file:/dev/tty, exec:...,pty), the terminal parameters defined in the UN*X\r\ntermios mechanism are made available as address option parameters. Please note that changes of the parameters of\r\nyour interactive terminal remain effective after socatcqs termination, so you might have to enter dqresetdq or dqstty\r\nsanedq in your shell afterwards. For EXEC and SYSTEM addresses with option PTY, these options apply to the pty\r\nby the child processes.\r\nCWb0\r\nDisconnects the terminal.\r\nCWb19200\r\nSets the serial line speed to 19200 baud. Some other rates are possible; use something like CWsocat -hh |grep\r\ncq b[1-9]cq to find all speeds supported by your implementation.\r\nNote: On some operating systems, these options may not be available. Use ispeed or ospeed instead.\r\nCWecho=\u003cbool\u003e\r\nEnables or disables local echo (example).\r\nCWicanon=\u003cbool\u003e\r\nSets or clears canonical mode, enabling line buffering and some special characters.\r\nhttps://linux.die.net/man/1/socat\r\nPage 32 of 48\n\nCWraw\r\nSets raw mode, thus passing input and output almost unprocessed (example).\r\nCWignbrk=\u003cbool\u003e\r\nIgnores or interpretes the BREAK character (e.g., ^C)\r\nCWbrkint=\u003cbool\u003e\r\nCWbs0\r\nCWbs1\r\nCWbsdly=\u003c0|1\u003e\r\nCWclocal=\u003cbool\u003e\r\n.\r\n.nf cr0 cr1 cr2 cr3 .fi .IP Sets the carriage return delay to 0, 1, 2, or 3, respectively. 0 means no delay,\r\nthe other values are terminal dependent.\r\nCWcrdly=\u003c0|1|2|3\u003e\r\nCWcread=\u003cbool\u003e\r\nCWcrtscts=\u003cbool\u003e\r\n.\r\n.nf cs5 cs6 cs7 cs8 .fi .IP Sets the character size to 5, 6, 7, or 8 bits, respectively.\r\nCWcsize=\u003c0|1|2|3\u003e\r\nCWcstopb=\u003cbool\u003e\r\nSets two stop bits, rather than one.\r\nCWdsusp=\u003cbyte\u003e\r\nSets the value for the VDSUSP character that suspends the current foreground process and reactivates the\r\nshell (all except Linux).\r\nCWechoctl=\u003cbool\u003e\r\nEchos control characters in hat notation (e.g. ^A)\r\nCWechoe=\u003cbool\u003e\r\nCWechok=\u003cbool\u003e\r\nCWechoke=\u003cbool\u003e\r\nCWechonl=\u003cbool\u003e\r\nCWechoprt=\u003cbool\u003e\r\nCWeof=\u003cbyte\u003e\r\nCWeol=\u003cbyte\u003e\r\nCWeol2=\u003cbyte\u003e\r\nCWerase=\u003cbyte\u003e\r\nCWdiscard=\u003cbyte\u003e\r\nCWff0\r\nCWff1\r\nCWffdly=\u003cbool\u003e\r\nCWflusho=\u003cbool\u003e\r\nCWhupcl=\u003cbool\u003e\r\nhttps://linux.die.net/man/1/socat\r\nPage 33 of 48\n\nCWicrnl=\u003cbool\u003e\r\nCWiexten=\u003cbool\u003e\r\nCWigncr=\u003cbool\u003e\r\nCWignpar=\u003cbool\u003e\r\nCWimaxbel=\u003cbool\u003e\r\nCWinlcr=\u003cbool\u003e\r\nCWinpck=\u003cbool\u003e\r\nCWintr=\u003cbyte\u003e\r\nCWisig=\u003cbool\u003e\r\nCWispeed=\u003cunsigned-int\u003e\r\nSet the baud rate for incoming data on this line.\r\nSee also: ospeed, b19200\r\nCWistrip=\u003cbool\u003e\r\nCWiuclc=\u003cbool\u003e\r\nCWixany=\u003cbool\u003e\r\nCWixoff=\u003cbool\u003e\r\nCWixon=\u003cbool\u003e\r\nCWkill=\u003cbyte\u003e\r\nCWlnext=\u003cbyte\u003e\r\nCWmin=\u003cbyte\u003e\r\nCWnl0\r\nSets the newline delay to 0.\r\nCWnl1\r\nCWnldly=\u003cbool\u003e\r\nCWnoflsh=\u003cbool\u003e\r\nCWocrnl=\u003cbool\u003e\r\nCWofdel=\u003cbool\u003e\r\nCWofill=\u003cbool\u003e\r\nCWolcuc=\u003cbool\u003e\r\nCWonlcr=\u003cbool\u003e\r\nCWonlret=\u003cbool\u003e\r\nCWonocr=\u003cbool\u003e\r\nCWopost=\u003cbool\u003e\r\nEnables or disables output processing; e.g., converts NL to CR-NL.\r\nCWospeed=\u003cunsigned-int\u003e\r\nSet the baud rate for outgoing data on this line.\r\nSee also: ispeed, b19200\r\nCWparenb=\u003cbool\u003e\r\nEnable parity generation on output and parity checking for input.\r\nCWparmrk=\u003cbool\u003e\r\nCWparodd=\u003cbool\u003e\r\nCWpendin=\u003cbool\u003e\r\nCWquit=\u003cbyte\u003e\r\nhttps://linux.die.net/man/1/socat\r\nPage 34 of 48\n\nCWreprint=\u003cbyte\u003e\r\nCWsane\r\nBrings the terminal to something like a useful default state.\r\nCWstart=\u003cbyte\u003e\r\nCWstop=\u003cbyte\u003e\r\nCWsusp=\u003cbyte\u003e\r\nCWswtc=\u003cbyte\u003e\r\nCWtab0\r\nCWtab1\r\nCWtab2\r\nCWtab3\r\nCWtabdly=\u003cunsigned-int\u003e\r\nCWtime=\u003cbyte\u003e\r\nCWtostop=\u003cbool\u003e\r\nCWvt0\r\nCWvt1\r\nCWvtdly=\u003cbool\u003e\r\nCWwerase=\u003cbyte\u003e\r\nCWxcase=\u003cbool\u003e\r\nCWxtabs\r\nCWi-pop-all\r\nWith UNIX System V STREAMS, removes all drivers from the stack.\r\nCWi-push=\u003cstring\u003e\r\nWith UNIX System V STREAMS, pushes the driver (module) with the given name (string) onto the stack.\r\nFor example, to make sure that a character device on Solaris supports termios etc, use the following options:\r\nCWi-pop-all,i-push=ptem,i-push=ldterm,i-push=ttcompat\r\nPTY option group\r\nThese options are intended for use with the pty address type.\r\nCWlink=\u003cfilename\u003e\r\nGenerates a symbolic link that points to the actual pseudo terminal (pty). This might help to solve the\r\nproblem that ptys are generated with more or less unpredictable names, making it difficult to directly access\r\nthe socat generated pty automatically. With this option, the user can specify a dqfixdq point in the file\r\nhierarchy that helps him to access the actual pty (example). Beginning with socat version 1.4.3, the symbolic\r\nlink is removed when the address is closed (but see option unlink-close).\r\nCWwait-slave\r\nBlocks the open phase until a process opens the slave side of the pty. Usually, socat continues after\r\ngenerating the pty with opening the next address or with entering the transfer loop. With the wait-slave\r\noption, socat waits until some process opens the slave side of the pty before continuing. This option only\r\nworks if the operating system provides the CWpoll() system call. And it depends on an undocumented\r\nbehaviour of ptycqs, so it does not work on all operating systems. It has successfully been tested on Linux,\r\nFreeBSD, NetBSD, and on Tru64 with openpty.\r\nhttps://linux.die.net/man/1/socat\r\nPage 35 of 48\n\nCWpty-interval=\u003cseconds\u003e\r\nWhen the wait-slave option is set, socat periodically checks the HUP condition using CWpoll() to find if the\r\nptycqs slave side has been opened. The default polling interval is 1s. Use the pty-interval option [timeval] to\r\nchange this value.\r\nOPENSSL option group\r\nThese options apply to the openssl and openssl-listen address types.\r\nCWcipher=\u003ccipherlist\u003e\r\nSelects the list of ciphers that may be used for the connection. See the man page of CWciphers , section\r\nCIPHER LIST FORMAT, for detailed information about syntax, values, and default of \u003ccipherlist\u003e.\r\nSeveral cipher strings may be given, separated by cq:cq. Some simple cipher strings:\r\n3DES\r\nUses a cipher suite with triple DES.\r\nMD5\r\nUses a cipher suite with MD5.\r\naNULL\r\nUses a cipher suite without authentication.\r\nNULL\r\nDoes not use encryption.\r\nHIGH\r\nUses a cipher suite with dqhighdq encryption. Note that the peer must support the selected property, or the\r\nnegotiation will fail.\r\nCWmethod=\u003cssl-method\u003e\r\nSets the protocol version to be used. Valid strings (not case sensitive) are:\r\nCWSSLv2\r\nSelect SSL protocol version 2.\r\nCWSSLv3\r\nSelect SSL protocol version 3.\r\nCWSSLv23\r\nSelect SSL protocol version 2 or 3. This is the default when this option is not provided.\r\nCWTLSv1\r\nSelect TLS protocol version 1.\r\nCWverify=\u003cbool\u003e\r\nControls check of the peercqs certificate. Default is 1 (true). Disabling verify might open your socket for\r\neveryone, making the encryption useless!\r\nCWcert=\u003cfilename\u003e\r\nSpecifies the file with the certificate and private key for authentication. The certificate must be in OpenSSL\r\nformat (*.pem). With openssl-listen, use of this option is strongly recommended. Except with cipher aNULL,\r\ndqno shared ciphersdq error will occur when no certificate is given.\r\nCWkey=\u003cfilename\u003e\r\nSpecifies the file with the private key. The private key may be in this file or in the file given with the cert\r\noption. The party that has to proof that it is the owner of a certificate needs the private key.\r\nhttps://linux.die.net/man/1/socat\r\nPage 36 of 48\n\nCWdhparams=\u003cfilename\u003e\r\nSpecifies the file with the Diffie Hellman parameters. These parameters may also be in the file given with the\r\ncert option in which case the dhparams option is not needed.\r\nCWcafile=\u003cfilename\u003e\r\nSpecifies the file with the trusted (root) authority certificates. The file must be in PEM format and should\r\ncontain one or more certificates. The party that checks the authentication of its peer trusts only certificates\r\nthat are in this file.\r\nCWcapath=\u003cdirname\u003e\r\nSpecifies the directory with the trusted (root) certificates. The directory must contain certificates in PEM\r\nformat and their hashes (see OpenSSL documentation)\r\nCWegd=\u003cfilename\u003e\r\nOn some systems, openssl requires an explicit source of random data. Specify the socket name where an\r\nentropy gathering daemon like egd provides random data, e.g. /dev/egd-pool.\r\nCWpseudo\r\nOn systems where openssl cannot find an entropy source and where no entropy gathering daemon can be\r\nutilized, this option activates a mechanism for providing pseudo entropy. This is archieved by taking the\r\ncurrent time in microseconds for feeding the libc pseudo random number generator with an initial value.\r\nopenssl is then feeded with output from random\\() calls.\r\nNOTE:This mechanism is not sufficient for generation of secure keys!\r\nCWcompress\r\nEnable or disable the use of compression for a connection. Setting this to dqnonedq disables compression,\r\nsetting it to dqautodq lets OpenSSL choose the best available algorithm supported by both parties. The\r\ndefault is to not touch any compression-related settings. NOTE: Requires OpenSSL 0.9.8 or higher and\r\ndisabling compression with OpenSSL 0.9.8 affects all new connections in the process.\r\nCWfips\r\nEnables FIPS mode if compiled in. For info about the FIPS encryption implementation standard see\r\nhttp://oss-institute.org/fips-faq.html. This mode might require that the involved certificates are generated\r\nwith a FIPS enabled version of openssl. Setting or clearing this option on one socat address affects all\r\nOpenSSL addresses of this process.\r\nRETRY option group\r\nOptions that control retry of some system calls, especially connection attempts.\r\nCWretry=\u003cnum\u003e\r\nNumber of retries before the connection or listen attempt is aborted. Default is 0, which means just one\r\nattempt.\r\nCWinterval=\u003ctimespec\u003e\r\nTime between consecutive attempts (seconds, [timespec]). Default is 1 second.\r\nCWforever\r\nPerforms an unlimited number of retry attempts.\r\nTUN option group\r\nOptions that control Linux TUN/TAP interface device addresses.\r\nhttps://linux.die.net/man/1/socat\r\nPage 37 of 48\n\nCWtun-device=\u003cdevice-file\u003e\r\nInstructs socat to take another path for the TUN clone device. Default is CW/dev/net/tun.\r\nCWtun-name=\u003cif-name\u003e\r\nGives the resulting network interface a specific name instead of the system generated (tun0, tun1, etc.)\r\nCWtun-type=[tun|tap]\r\nSets the type of the TUN device; use this option to generate a TAP device. See the Linux docu for the\r\ndifference between these types. When you try to establish a tunnel between two TUN devices, their types\r\nshould be the same.\r\nCWiff-no-pi\r\nSets the IFF_NO_PI flag which controls if the device includes additional packet information in the tunnel.\r\nWhen you try to establish a tunnel between two TUN devices, these flags should have the same values.\r\nCWiff-up\r\nSets the TUN network interface status UP. Strongly recommended.\r\nCWiff-broadcast\r\nSets the BROADCAST flag of the TUN network interface.\r\nCWiff-debug\r\nSets the DEBUG flag of the TUN network interface.\r\nCWiff-loopback\r\nSets the LOOPBACK flag of the TUN network interface.\r\nCWiff-pointopoint\r\nSets the POINTOPOINT flag of the TUN device.\r\nCWiff-notrailers\r\nSets the NOTRAILERS flag of the TUN device.\r\nCWiff-running\r\nSets the RUNNING flag of the TUN device.\r\nCWiff-noarp\r\nSets the NOARP flag of the TUN device.\r\nCWiff-promisc\r\nSets the PROMISC flag of the TUN device.\r\nCWiff-allmulti\r\nSets the ALLMULTI flag of the TUN device.\r\nCWiff-master\r\nSets the MASTER flag of the TUN device.\r\nCWiff-slave\r\nSets the SLAVE flag of the TUN device.\r\nCWiff-multicast\r\nSets the MULTICAST flag of the TUN device.\r\nCWiff-portsel\r\nSets the PORTSEL flag of the TUN device.\r\nCWiff-automedia\r\nSets the AUTOMEDIA flag of the TUN device.\r\nCWiff-dynamic\r\nSets the DYNAMIC flag of the TUN device.\r\nhttps://linux.die.net/man/1/socat\r\nPage 38 of 48\n\nData Values\r\nThis section explains the different data types that address parameters and address options can take.\r\naddress-range\r\nIs currently only implemented for IPv4 and IPv6. See address-option 'rangecq\r\nbool\r\ndq0dq or dq1dq; if value is omitted, dq1dq is taken.\r\nbyte\r\nAn unsigned int number, read with CWstrtoul() , lower or equal to CWUCHAR_MAX .\r\ncommand-line\r\nA string specifying a program name and its arguments, separated by single spaces.\r\ndata\r\nA raw data specification following dalan syntax. Currently the only valid form is a string starting with cqxcq\r\nfollowed by an even number of hex digits, specifying a sequence of bytes.\r\ndirectory\r\nA string with usual UN*X directory name semantics.\r\nfacility\r\nThe name of a syslog facility in lower case characters.\r\nfdnum\r\nAn unsigned int type, read with CWstrtoul() , specifying a UN*X file descriptor.\r\nfilename\r\nA string with usual UN*X filename semantics.\r\ngroup\r\nIf the first character is a decimal digit, the value is read with CWstrtoul() as unsigned integer specifying a\r\ngroup id. Otherwise, it must be an existing group name.\r\nint\r\nA number following the rules of the CWstrtol() function with base dq0dq, i.e. decimal number, octal number\r\nwith leading dq0dq, or hexadecimal number with leading dq0xdq. The value must fit into a C int.\r\ninterface\r\nA string specifying the device name of a network interface as shown by ifconfig or procan, e.g. dqeth0dq.\r\nIP address\r\nAn IPv4 address in numbers-and-dots notation, an IPv6 address in hex notation enclosed in brackets, or a\r\nhostname that resolves to an IPv4 or an IPv6 address.\r\nExamples: 127.0.0.1, [::1], www.dest-unreach.org, dns1\r\nIPv4 address\r\nAn IPv4 address in numbers-and-dots notation or a hostname that resolves to an IPv4 address.\r\nExamples: 127.0.0.1, www.dest-unreach.org, dns2\r\nIPv6 address\r\nAn iPv6 address in hexnumbers-and-colons notation enclosed in brackets, or a hostname that resolves to an\r\nIPv6 address.\r\nExamples: [::1], [1234:5678:9abc:def0:1234:5678:9abc:def0], ip6name.domain.org\r\nlong\r\nhttps://linux.die.net/man/1/socat\r\nPage 39 of 48\n\nA number read with CWstrtol() . The value must fit into a C long.\r\nlong long\r\nA number read with CWstrtoll() . The value must fit into a C long long.\r\noff_t\r\nAn implementation dependend signed number, usually 32 bits, read with strtol or strtoll.\r\noff64_t\r\nAn implementation dependend signed number, usually 64 bits, read with strtol or strtoll.\r\nmode_t\r\nAn unsigned integer, read with CWstrtoul() , specifying mode (permission) bits.\r\npid_t\r\nA number, read with CWstrtol() , specifying a process id.\r\nport\r\nA uint16_t (16 bit unsigned number) specifying a TCP or UDP port, read with CWstrtoul() .\r\nprotocol\r\nAn unsigned 8 bit number, read with CWstrtoul() .\r\nsize_t\r\nAn unsigned number with size_t limitations, read with CWstrtoul .\r\nsockname\r\nA socket address. See address-option 'bindcq\r\nstring\r\nA sequence of characters, not containing cq\\0cq and, depending on the position within the command line,\r\ncq:cq, cq,cq, or dq!!dq. Note that you might have to escape shell meta characters in the command line.\r\nTCP service\r\nA service name, not starting with a digit, that is resolved by CWgetservbyname() , or an unsigned int 16 bit\r\nnumber read with CWstrtoul() .\r\ntimeval\r\nA double float specifying seconds; the number is mapped into a struct timeval, consisting of seconds and\r\nmicroseconds.\r\ntimespec\r\nA double float specifying seconds; the number is mapped into a struct timespec, consisting of seconds and\r\nnanoseconds.\r\nUDP service\r\nA service name, not starting with a digit, that is resolved by CWgetservbyname() , or an unsigned int 16 bit\r\nnumber read with CWstrtoul() .\r\nunsigned int\r\nA number read with CWstrtoul() . The value must fit into a C unsigned int.\r\nuser\r\nIf the first character is a decimal digit, the value is read with CWstrtoul() as unsigned integer specifying a\r\nuser id. Otherwise, it must be an existing user name.\r\nExamples\r\nCWsocat - TCP4:www.domain.org:80\r\nhttps://linux.die.net/man/1/socat\r\nPage 40 of 48\n\ntransfers data between STDIO (-) and a\r\nTCP4 connection to port 80 of host www.domain.org. This example results in an interactive connection\r\nsimilar to telnet or netcat. The stdin terminal parameters are not changed, so you may close the relay with ^D\r\nor abort it with ^C. .\r\n.nf socat -d -d READLINE,history=$HOME/.http_history \\ TCP4:www.domain.org:www,crnl .fi\r\nthis is similar to the previous example, but you can edit the current line in a\r\nbash like manner (READLINE) and use the history file .http_history; socat prints messages about progress (-\r\nd -d). The port is specified by service name (www), and correct network line termination characters (crnl)\r\ninstead of NL are used.\r\nCWsocat TCP4-LISTEN:www TCP4:www.domain.org:www\r\ninstalls a simple TCP port forwarder. With\r\nTCP4-LISTEN it listens on local port dqwwwdq until a connection comes in, accepts it, then connects to the\r\nremote host (TCP4) and starts data transfer. It will not accept a econd connection. .\r\n.nf socat -d -d -lmlocal2 \\ TCP4-\r\nLISTEN:80,bind=myaddr1,reuseaddr,fork,su=nobody,range=10.0.0.0/8 \\\r\nTCP4:www.domain.org:80,bind=myaddr2 .fi\r\nTCP port forwarder, each side bound to another local IP address\r\n(bind). This example handles an almost arbitrary number of parallel or consecutive connections by forkcqing\r\na new process after each CWaccept() . It provides a little security by sucqing to user nobody after forking; it\r\nonly permits connections from the private 10 network (range); due to reuseaddr, it allows immediate restart\r\nafter master processcqs termination, even if some child sockets are not completely shut down. With -\r\nlmlocal2, socat logs to stderr until successfully reaching the accept loop. Further logging is directed to syslog\r\nwith facility local2. .\r\n.nf socat TCP4-LISTEN:5555,fork,tcpwrap=script \\\r\nEXEC:/bin/myscript,chroot=/home/sandbox,su-d=sandbox,pty,stderr .fi\r\na simple server that accepts connections\r\n(TCP4-LISTEN) and forkcqs a new child process for each connection; every child acts as single relay. The\r\nclient must match the rules for daemon process name dqscriptdq in /etc/hosts.allow and /etc/hosts.deny,\r\notherwise it is refused access (see dqman 5 hosts_accessdq). For EXECcquting the program, the child\r\nprocess chrootcqs to /home/sandbox, sucqs to user sandbox, and then starts the program\r\n/home/sandbox/bin/myscript. Socat and myscript communicate via a pseudo tty (pty); myscriptcqs stderr is\r\nredirected to stdout, so its error messages are transferred via socat to the connected client. .\r\n.nf socat EXEC:\"mail.sh target@domain.com\",fdin=3,fdout=4 \\\r\nTCP4:mail.relay.org:25,crnl,bind=alias1.server.org,mss=512 .fi\r\nmail.sh is a shell script, distributed with socat, that implements a\r\nsimple SMTP client. It is programmed to dqspeakdq SMTP on its FDs 3 (in) and 4 (out). The fdin and fdout\r\noptions tell socat to use these FDs for communication with the program. Because mail.sh inherits stdin and\r\nstdout while socat does not use them, the script can read a mail body from stdin. Socat makes alias1 your\r\nlocal source address (bind), cares for correct network line termination (crnl) and sends at most 512 data bytes\r\nper packet (mss).\r\nCWsocat -,raw,echo=0,escape=0x0f /dev/ttyS0,raw,echo=0,crnl\r\nopens an interactive connection via the serial line, e.g. for talking with a\r\nhttps://linux.die.net/man/1/socat\r\nPage 41 of 48\n\nmodem. raw and echo set the consolecqs and ttyS0cqs terminal parameters to practicable values, crnl\r\nconverts to correct newline characters. escape allows to terminate the socat process with character control-O.\r\nConsider using READLINE instead of the first address. .\r\n.nf socat UNIX-LISTEN:/tmp/.X11-unix/X1,fork \\\r\nSOCKS4:host.victim.org:127.0.0.1:6000,socksuser=nobody,sourceport=20 .fi\r\nwith UNIX-LISTEN, socat opens a listening\r\nUNIX domain socket /tmp/.X11-unix/X1. This path corresponds to local XWindow display :1 on your\r\nmachine, so XWindow client connections to DISPLAY=:1 are accepted. Socat then speaks with the\r\nSOCKS4 server host.victim.org that might permit sourceport 20 based connections due to an FTP related\r\nweakness in its static IP filters. Socat pretends to be invoked by socksuser nobody, and requests to be\r\nconnected to loopback port 6000 (only weak sockd configurations will allow this). So we get a connection to\r\nthe victims XWindow server and, if it does not require MIT cookies or Kerberos authentication, we can start\r\nwork. Please note that there can only be one connection at a time, because TCP can establish only one\r\nsession with a given set of addresses and ports.\r\nCWsocat -u /tmp/readdata,seek-end=0,ignoreeof -\r\nthis is an example for unidirectional data transfer\r\n(-u). Socat transfers data from file /tmp/readdata (implicit address GOPEN), starting at its current end (seek-end=0 lets socat start reading at current end of file; use seek=0 or no seek option to first read the existing\r\ndata) in a dqtail -fdq like mode (ignoreeof). The dqfiledq might also be a listening UNIX domain socket (do\r\nnot use a seek option then). .\r\n.nf (sleep 5; echo PASSWORD; sleep 5; echo ls; sleep 1) | socat - EXEC:'ssh -l user\r\nserver',pty,setsid,ctty .fi\r\nEXECcqutes an ssh session to server. Uses a pty for communication between socat and\r\nssh, makes it sshcqs controlling tty (ctty), and makes this pty the owner of a new process group (setsid), so\r\nssh accepts the password from socat. .\r\n.nf socat -u TCP4-LISTEN:3334,reuseaddr,fork \\ OPEN:/tmp/in.log,creat,append .fi\r\nimplements a simple network based message collector.\r\nFor each client connecting to port 3334, a new child process is generated (option fork). All data sent by the\r\nclients are appendcqed to the file /tmp/in.log. If the file does not exist, socat creatcqs it. Option reuseaddr\r\nallows immediate restart of the server process.\r\nCWsocat READLINE,noecho=cq[Pp]assword:cq EXEC:cqftp ftp.server.comcq,pty,setsid,ctty\r\nwraps a command line history (READLINE) around the EXECcquted ftp client utility.\r\nThis allows editing and reuse of FTP commands for relatively comfortable browsing through the ftp\r\ndirectory hierarchy. The password is echoed! pty is required to have ftp issue a prompt. Nevertheless, there\r\nmay occur some confusion with the password and FTP prompts.\r\n(CWsocat PTY,link=$HOME/dev/vmodem0,raw,echo=0,wait-slave EXEC:cqdqssh modemserver.us.org socat\r\n- /dev/ttyS0,nonblock,raw,echo=0dqcq)\r\ngenerates a pseudo terminal\r\ndevice (PTY) on the client that can be reached under the symbolic link $HOME/dev/vmodem0. An\r\napplication that expects a serial line or modem can be configured to use $HOME/dev/vmodem0; its traffic\r\nwill be directed to a modemserver via ssh where another socat instance links it with /dev/ttyS0. .\r\n.nf socat TCP4-LISTEN:2022,reuseaddr,fork \\\r\nPROXY:proxy:www.domain.org:22,proxyport=3128,proxyauth=user:pass .fi\r\nhttps://linux.die.net/man/1/socat\r\nPage 42 of 48\n\nstarts a forwarder that accepts connections on port 2022, and directs them\r\nthrough the proxy daemon listening on port 3128 (proxyport) on host proxy, using the CONNECT method,\r\nwhere they are authenticated as dquserdq with dqpassdq (proxyauth). The proxy should establish connections\r\nto host www.domain.org on port 22 then.\r\nCWsocat - SSL:server:4443,cafile=server.crt,cert=client.pem\r\nis an OpenSSL client that tries to establish a secure connection to an SSL\r\nserver. Option cafile specifies a file that contains trust certificates: we trust the server only when it presents\r\none of these certificates and proofs that it owns the related private key. Otherwise the connection is\r\nterminated. With cert a file containing the client certificate and the associated private key is specified. This is\r\nrequired in case the server wishes a client authentication; many Internet servers do not.\r\nThe first address (cq-cq) can be replaced by almost any other socat address.\r\nCWsocat SSL-LISTEN:4443,reuseaddr,pf=ip4,fork,cert=server.pem,cafile=client.crt PIPE\r\nis an OpenSSL server that accepts TCP connections, presents the certificate\r\nfrom the file server.pem and forces the client to present a certificate that is verified against cafile.crt.\r\nThe second address (cqPIPEcq) can be replaced by almost any other socat address.\r\nFor instructions on generating and distributing OpenSSL keys and certificates see the additional socat docu\r\nCWsocat-openssl.txt.\r\nCWecho |socat -u - file:/tmp/bigfile,create,largefile,seek=100000000000\r\ncreates a 100GB sparse file; this requires a file system type that\r\nsupports this (ext2, ext3, reiserfs, jfs; not minix, vfat). The operation of writing 1 byte might take long\r\n(reiserfs: some minutes; ext2: dqnodq time), and the resulting file can consume some disk space with just its\r\ninodes (reiserfs: 2MB; ext2: 16KB).\r\nCWsocat tcp-l:7777,reuseaddr,fork system:cqfilan -i 0 -s \u003e\u00262cq,nofork\r\nlistens for incoming TCP connections on port 7777. For each accepted\r\nconnection, invokes a shell. This shell has its stdin and stdout directly connected to the TCP socket (nofork).\r\nThe shell starts filan and lets it print the socket addresses to stderr (your terminal window).\r\nCWecho -e dq\\0\\14\\0\\0\\cdq |socat -u - file:/usr/bin/squid.exe,seek=0x00074420\r\nfunctions as primitive binary editor: it writes the 4 bytes 000 014 000 000 to\r\nthe executable /usr/bin/squid at offset 0x00074420 (this is a real world patch to make the squid executable\r\nfrom Cygwin run under Windows, actual per May 2004).\r\nCWsocat - tcp:www.blackhat.org:31337,readbytes=1000\r\nconnects to an unknown service and prevents being flooded.\r\nCWsocat -U TCP:target:9999,end-close TCP-L:8888,reuseaddr,fork\r\nmerges data arriving from different TCP streams on port 8888 to just one stream\r\nto target:9999. The end-close option prevents the child processes forked off by the second address from\r\nterminating the shared connection to 9999 (close\\(2) just unlinks the inode which stays active as long as the\r\nparent process lives; shutdown\\(2) would actively terminate the connection).\r\nCWsocat - UDP4-DATAGRAM:192.168.1.0:123,sp=123,broadcast,range=192.168.1.0/24\r\nsends a broadcast to the network 192.168.1.0/24 and receives the replies of the\r\ntimeservers there. Ignores NTP packets from hosts outside this network.\r\nCWsocat - SOCKET-DATAGRAM:2:2:17:x007bxc0a80100x0000000000000000,bind=x007bx00000000x0000000000000000,setsockopt-int=1:6:1,range=x0000xc0a80100x0000000000000000:x0000xffffff00x0000000000000000\r\nhttps://linux.die.net/man/1/socat\r\nPage 43 of 48\n\nis semantically equivalent to the previous\r\nexample, but all parameters are specified in generic form. the value 6 of setsockopt-int is the Linux value for\r\nCWSO_BROADCAST.\r\nCWsocat - IP4-DATAGRAM:255.255.255.255:44,broadcast,range=10.0.0.0/8\r\nsends a broadcast to the local network\\(s) using protocol 44. Accepts replies\r\nfrom the private address range only.\r\nCWsocat - UDP4-DATAGRAM:224.255.0.1:6666,bind=:6666,ip-add-membership=224.255.0.1:eth0\r\ntransfers data from stdin to the specified multicast address using UDP. Both\r\nlocal and remote ports are 6666. Tells the interface eth0 to also accept multicast packets of the given group.\r\nMultiple hosts on the local network can run this command, so all data sent by any of the hosts will be\r\nreceived by all the other ones. Note that there are many possible reasons for failure, including IP-filters,\r\nrouting issues, wrong interface selection by the operating system, bridges, or a badly configured switch.\r\nCWsocat TCP:host2:4443 TUN:192.168.255.1/24,up\r\nestablishes one side of a virtual (but not private!) network with host2 where a\r\nsimilar process might run, with UDP-L and tun address 192.168.255.2. They can reach each other using the\r\naddresses 192.168.255.1 and 192.168.255.2. Note that streaming eg. via TCP or SSL does not guarantee to\r\nretain packet boundaries and may thus cause packet loss.\r\nCWsocat PTY,link=/var/run/ppp,raw,echo=0 INTERFACE:hdlc0\r\ncircumvents the problem that pppd requires a serial device and thus might not\r\nbe able to work on a synchronous line that is represented by a network device. socat creates a PTY to make\r\npppd happy, binds to the network interface CWhdlc0, and can transfer data between both devices. Use pppd\r\non device CW/var/run/ppp then.\r\nCWsocat -T 1 -d -d TCP-L:10081,reuseaddr,fork,crlf SYSTEM:dqecho -e \\dq\\\\\\dqHTTP/1.0 200\r\nOK\\\\\\nDocumentType: text/plain\\\\\\n\\\\\\ndate: \\$\\\r\n(date\\)\\\\\\nserver:\\$SOCAT_SOCKADDR:\\$SOCAT_SOCKPORT\\\\\\nclient:\r\n\\$SOCAT_PEERADDR:\\$SOCAT_PEERPORT\\\\\\n\\\\\\dq\\dq; cat; echo -e \\dq\\\\\\dq\\\\\\n\\\\\\dq\\dqdq\r\ncreates a simple HTTP echo server: each HTTP client that connects gets a valid\r\nHTTP reply that contains information about the client address and port as it is seen by the server host, the\r\nhost address (which might vary on multihomed servers), and the original client request.\r\nCWsocat -d -d UDP4-RECVFROM:9999,so-broadcast,so-timestamp,ip-pktinfo,ip-recverr,ip-recvopts,ip-recvtos,ip-recvttl!!- SYSTEM:cqexport; sleep 1cq |grep SOCAT\r\nwaits for an incoming UDP packet on port 9999 and prints the environment\r\nvariables provided by socat. On BSD based systems you have to replace CWip-pktinfo with CWip-recvdstaddr,CWip-recvif. Especially interesting is SOCAT_IP_DSTADDR: it contains the target address of\r\nthe packet which may be a unicast, multicast, or broadcast address.\r\nCW\r\nDiagnostics\r\nSocat uses a logging mechanism that allows to filter messages by severity.\r\nThe\r\nseverities provided are more or less compatible to the appropriate syslog priority. With one or up to four\r\noccurrences of the -d command line option, the lowest priority of messages that are issued can be selected.\r\nhttps://linux.die.net/man/1/socat\r\nPage 44 of 48\n\nEach message contains a single uppercase character specifying the messages severity (one of F, E, W, N, I, or\r\nD)\r\nFATAL:\r\nConditions that require unconditional and immediate program termination.\r\nERROR:\r\nConditions that prevent proper program processing. Usually the program is terminated (see option -s).\r\nWARNING:\r\nSomething did not function correctly or is in a state where correct further processing cannot be guaranteed,\r\nbut might be possible.\r\nNOTICE:\r\nInteresting actions of the program, e.g. for supervising socat in some kind of server mode.\r\nINFO:\r\nDescription of what the program does, and maybe why it happens. Allows to monitor the lifecycles of file\r\ndescriptors.\r\nDEBUG:\r\nDescription of how the program works, all system or library calls and their results.\r\nLog messages can be written to stderr, to a file, or to syslog.\r\nOn exit, socat gives status 0 if it terminated due to EOF or inactivity timeout, with a positive value on error, and\r\nwith a negative value on fatal error.\r\nFiles\r\n/usr/bin/socat\r\n/usr/bin/filan\r\n/usr/bin/procan\r\nEnvironment Variables\r\nInput variables carry information from the environment to socat, output variables are set by socat for use in\r\nexecuted scripts and programs.\r\nIn the output variables beginning with dqSOCATdq this prefix is actually replaced by the upper case name of the\r\nexecutable or the value of option -lp.\r\nSOCAT_DEFAULT_LISTEN_IP (input)\r\n(Values 4 or 6) Sets the IP version to be used for listen, recv, and recvfrom addresses if no pf (protocol-family) option is given. Is overridden by socat options -4 or -6.\r\nSOCAT_PREFERRED_RESOLVE_IP (input)\r\n(Values 0, 4, or 6) Sets the IP version to be used when resolving target host names when version is not\r\nspecified by address type, option pf (protocol-family), or address format. If name resolution does not return a\r\nmatching entry, the first result (with differing IP version) is taken. With value 0, socat always selects the first\r\nrecord and its IP version.\r\nSOCAT_FORK_WAIT (input)\r\nhttps://linux.die.net/man/1/socat\r\nPage 45 of 48\n\nSpecifies the time (seconds) to sleep the parent and child processes after successful fork\\(). Useful for\r\ndebugging.\r\nSOCAT_VERSION (output)\r\nSocat sets this variable to its version string, e.g. CWdq1.7.0.0dq for released versions or e.g.\r\nCWdq1.6.0.1+envvardq for temporary versions; can be used in scripts invoked by socat.\r\nSOCAT_PID (output)\r\nSocat sets this variable to its process id. In case of fork address option, SOCAT_PID gets the child processes\r\nid. Forking for exec and system does not change SOCAT_PID.\r\nSOCAT_PPID (output)\r\nSocat sets this variable to its process id. In case of fork, SOCAT_PPID keeps the pid of the master process.\r\nSOCAT_PEERADDR (output)\r\nWith passive socket addresses (all LISTEN and RECVFROM addresses), this variable is set to a string\r\ndescribing the peers socket address. Port information is not included.\r\nSOCAT_PEERPORT (output)\r\nWith appropriate passive socket addresses (TCP, UDP, and SCTP - LISTEN and RECVFROM), this variable\r\nis set to a string containing the number of the peer port.\r\nSOCAT_SOCKADDR (output)\r\nWith all LISTEN addresses, this variable is set to a string describing the local socket address. Port\r\ninformation is not included example\r\nSOCAT_SOCKPORT (output)\r\nWith TCP-LISTEN, UDP-LISTEN, and SCTP-LISTEN addresses, this variable is set to the local port.\r\nSOCAT_TIMESTAMP (output)\r\nWith all RECVFROM addresses where address option so-timestamp is applied, socat sets this variable to the\r\nresulting timestamp.\r\nSOCAT_IP_OPTIONS (output)\r\nWith all IPv4 based RECVFROM addresses where address option ip-recvopts is applied, socat fills this\r\nvariable with the IP options of the received packet.\r\nSOCAT_IP_DSTADDR (output)\r\nWith all IPv4 based RECVFROM addresses where address option ip-recvdstaddr (BSD) or ip-pktinfo (other\r\nplatforms) is applied, socat sets this variable to the destination address of the received packet. This is\r\nparticularly useful to identify broadcast and multicast addressed packets.\r\nSOCAT_IP_IF (output)\r\nWith all IPv4 based RECVFROM addresses where address option ip-recvif (BSD) or ip-pktinfo (other\r\nplatforms) is applied, socat sets this variable to the name of the interface where the packet was received.\r\nSOCAT_IP_LOCADDR (output)\r\nWith all IPv4 based RECVFROM addresses where address option ip-pktinfo is applied, socat sets this\r\nvariable to the address of the interface where the packet was received.\r\nSOCAT_IP_TOS (output)\r\nWith all IPv4 based RECVFROM addresses where address option ip-recvtos is applied, socat sets this\r\nvariable to the TOS (type of service) of the received packet.\r\nSOCAT_IP_TTL (output)\r\nWith all IPv4 based RECVFROM addresses where address option ip-recvttl is applied, socat sets this\r\nvariable to the TTL (time to live) of the received packet.\r\nhttps://linux.die.net/man/1/socat\r\nPage 46 of 48\n\nSOCAT_IPV6_HOPLIMIT (output)\r\nWith all IPv6 based RECVFROM addresses where address option ipv6-recvhoplimit is applied, socat sets\r\nthis variable to the hoplimit value of the received packet.\r\nSOCAT_IPV6_DSTADDR (output)\r\nWith all IPv6 based RECVFROM addresses where address option ipv6-recvpktinfo is applied, socat sets this\r\nvariable to the destination address of the received packet.\r\nSOCAT_IPV6_TCLASS (output)\r\nWith all IPv6 based RECVFROM addresses where address option ipv6-recvtclass is applied, socat sets this\r\nvariable to the transfer class of the received packet.\r\nHOSTNAME (input)\r\nIs used to determine the hostname for logging (see -lh).\r\nLOGNAME (input)\r\nIs used as name for the socks client user name if no socksuser is given.\r\nWith options su and su-d, LOGNAME is set to the given user name.\r\nUSER (input)\r\nIs used as name for the socks client user name if no socksuser is given and LOGNAME is empty.\r\nWith options su and su-d, USER is set to the given user name.\r\nSHELL (output)\r\nWith options su and su-d, SHELL is set to the login shell of the given user.\r\nPATH (output)\r\nCan be set with option path for exec and system addresses.\r\nHOME (output)\r\nWith options su and su-d, HOME is set to the home directory of the given user.\r\nCredits\r\nThe work of the following groups and organizations was invaluable for this\r\nproject:\r\nThe FSF (GNU, http://www.fsf.org/ project with their free and portable development software and lots of other\r\nuseful tools and libraries.\r\nThe Linux developers community (http://www.linux.org/) for providing a free, open source operating system.\r\nThe Open Group (http://www.unix-systems.org/) for making their standard specifications available on the Internet\r\nfor free.\r\nVersion\r\nThis man page describes version 1.7.2 of socat.\r\nBugs\r\nAddresses cannot be nested, so a single socat process cannot, e.g., drive ssl over socks.\r\nhttps://linux.die.net/man/1/socat\r\nPage 47 of 48\n\nAddress option ftruncate without value uses default 1 instead of 0.\r\nVerbose modes (-x and/or -v) display line termination characters inconsistently when address options cr or crnl are\r\nused: They show the data after conversion in either direction.\r\nThe data transfer blocksize setting (-b) is ignored with address readline.\r\nSend bug reports to \u003csocat@dest-unreach.org\u003e\r\nSee Also\r\nnc\\(1), netcat6\\(1), sock\\(1), rinetd\\(8), cage\\(1), socks.conf\\(5), openssl\\(1), stunnel\\(8), pty\\(1), rlwrap\\(1), setsid\\\r\n(1)\r\nSocat home page http://www.dest-unreach.org/socat/\r\nAuthor\r\nGerhard Rieger \u003crieger@dest-unreach.org\u003e\r\nSource: https://linux.die.net/man/1/socat\r\nhttps://linux.die.net/man/1/socat\r\nPage 48 of 48",
	"extraction_quality": 1,
	"language": "EN",
	"sources": [
		"ETDA"
	],
	"references": [
		"https://linux.die.net/man/1/socat"
	],
	"report_names": [
		"socat"
	],
	"threat_actors": [],
	"ts_created_at": 1775434688,
	"ts_updated_at": 1775791249,
	"ts_creation_date": 0,
	"ts_modification_date": 0,
	"files": {
		"pdf": "https://archive.orkl.eu/9f11c73036453889b718489cab69874e439a4c63.pdf",
		"text": "https://archive.orkl.eu/9f11c73036453889b718489cab69874e439a4c63.txt",
		"img": "https://archive.orkl.eu/9f11c73036453889b718489cab69874e439a4c63.jpg"
	}
}