.TH "socat" "1" "" "" "" .PP .SH "NAME" socat \- Multipurpose relay (SOcket CAT) .PP .SH "SYNOPSIS" \f(CWsocat [options]
\fP .br \f(CWsocat \-V\fP .br \f(CWsocat \-h[h[h]] | \-?[?[?]]\fP .br \f(CWfilan\fP .br \f(CWprocan\fP .PP .SH "DESCRIPTION" .PP \fBSocat\fP is a command line based utility that establishes two bidirectional byte streams and transfers data between them\&. Because the streams can be constructed from a large set of different types of data sinks and sources (see address types), and because lots of address options may be applied to the streams, socat can be used for many different purposes\&. .PP \fBFilan\fP is a utility that prints information about its active file descriptors to stdout\&. It has been written for debugging \fBsocat\fP, but might be useful for other purposes too\&. Use the \-h option to find more infos\&. .PP \fBProcan\fP is a utility that prints information about process parameters to stdout\&. It has been written to better understand some UNIX process properties and for debugging \fBsocat\fP, but might be useful for other purposes too\&. .PP The life cycle of a \fBsocat\fP instance typically consists of four phases\&. .PP In the \fIinit\fP phase, the command line options are parsed and logging is initialized\&. .PP During the \fIopen\fP phase, \fBsocat\fP opens the first address and afterwards the second address\&. These steps are usually blocking; thus, especially for complex address types like socks, connection requests or authentication dialogs must be completed before the next step is started\&. .PP In the \fItransfer\fP phase, \fBsocat\fP watches both streams\(cq\& read and write file descriptors via \f(CWselect()\fP , and, when data is available on one side \fIand\fP can be written to the other side, socat reads it, performs newline character conversions if required, and writes the data to the write file descriptor of the other stream, then continues waiting for more data in both directions\&. .PP When one of the streams effectively reaches EOF, the \fIclosing\fP phase begins\&. \fBSocat\fP transfers the EOF condition to the other stream, i\&.e\&. tries to shutdown only its write stream, giving it a chance to terminate gracefully\&. For a defined time \fBsocat\fP continues to transfer data in the other direction, but then closes all remaining channels and terminates\&. .PP .SH "OPTIONS" .PP \fBSocat\fP provides some command line options that modify the behaviour of the program\&. They have nothing to do with so called address options that are used as parts of address specifications\&. .PP .IP "\fB\f(CW\-V\fP\fP" Print version and available feature information to stdout, and exit\&. .IP "\fB\f(CW\-h | \-?\fP\fP" Print a help text to stdout describing command line options and available address types, and exit\&. .IP "\fB\f(CW\-hh | \-??\fP\fP" Like \-h, plus a list of the short names of all available address options\&. Some options are platform dependend, so this output is helpful for checking the particular implementation\&. .IP "\fB\f(CW\-hhh | \-???\fP\fP" Like \-hh, plus a list of all available address option names\&. .IP "\fB\f(CW\-d\fP\fP" Without this option, only fatal, error, and warning messages are printed; applying this option also prints notice messages\&. See DIAGNOSTICS for more information\&. .IP "\fB\f(CW\-d0\fP\fP" With this option, only fatal and error messages are printed; this restores the behaviour of \fBsocat\fP up to version 1\&.7\&.4\&. .IP "\fB\f(CW\-d \-d | \-dd | \-d2\fP\fP" Prints fatal, error, warning, and notice messages\&. .IP "\fB\f(CW\-d \-d \-d | \-ddd | \-d3\fP\fP" Prints fatal, error, warning, notice, and info messages\&. .IP "\fB\f(CW\-d \-d \-d \-d | \-dddd | \-d4\fP\fP" Prints fatal, error, warning, notice, info, and debug messages\&. .IP "\fB\f(CW\-D\fP\fP" Logs information about file descriptors before starting the transfer phase\&. .IP "\fB\f(CW\-\-experimental\fP\fP" New features that are not well tested or are subject to change in the future must me explicitely enabled using this option\&. .IP "\fB\f(CW\-ly[]\fP\fP" Writes messages to syslog instead of stderr; severity as defined with \-d option\&. With optional , the syslog type can be selected, default is \(dq\&daemon\(dq\&\&. Third party libraries might not obey this option\&. .IP "\fB\f(CW\-lf\fP\fP\f(CW \fP" Writes messages to [filename] instead of stderr\&. Some third party libraries, in particular libwrap, might not obey this option\&. .IP "\fB\f(CW\-ls\fP\fP" Writes messages to stderr (this is the default)\&. Some third party libraries might not obey this option, in particular libwrap appears to only log to syslog\&. .IP "\fB\f(CW\-lp\fP\fP\f(CW\fP" Overrides the program name printed in error messages and used for constructing environment variable names\&. .IP "\fB\f(CW\-lu\fP\fP" Extends the timestamp of error messages to microsecond resolution\&. Does not work when logging to syslog\&. .IP "\fB\f(CW\-lm[]\fP\fP" Mixed log mode\&. During startup messages are printed to stderr; when \fBsocat\fP starts the transfer phase loop or daemon mode (i\&.e\&. after opening all streams and before starting data transfer, or, with listening sockets with fork option, before the first accept call), it switches logging to syslog\&. With optional , the syslog type can be selected, default is \(dq\&daemon\(dq\&\&. .IP "\fB\f(CW\-lh\fP\fP" Adds hostname to log messages\&. Uses the value from environment variable HOSTNAME or the value retrieved with \f(CWuname()\fP if HOSTNAME is not set\&. .IP "\fB\f(CW\-v\fP\fP" Writes the transferred data not only to their target streams, but also to stderr\&. The output format is text with some conversions for readability, and prefixed with \(dq\&> \(dq\& or \(dq\&< \(dq\& indicating flow directions\&. .IP "\fB\f(CW\-x\fP\fP" Writes the transferred data not only to their target streams, but also to stderr\&. The output format is hexadecimal, prefixed with \(dq\&> \(dq\& or \(dq\&< \(dq\& indicating flow directions\&. Can be combined with \f(CW\-v\fP \&. .IP "\fB\f(CW\-r \fP\fP" Dumps the raw (binary) data flowing from left to right address to the given file\&. The file name may contain references to environment variables and \f(CW$$\fP (pid), \f(CW$PROGNAME\fP (see option option \-lp), \f(CW$TIMESTAMP\fP (uses format %Y%m%dT%H%M%S), and \f(CWMICROS\fP (microseconds of daytime)\&. These references have to be protected from shell expansion of course\&. .IP "\fB\f(CW\-R \fP\fP" Dumps the raw (binary) data flowing from right to left address to the given file\&. See option \-r for customization of file name\&. .IP "\fB\f(CW\-b\fP\fP\f(CW\fP" Sets the data transfer block [size_t]\&. At most bytes are transferred per step\&. Default is 8192 bytes\&. .IP "\fB\f(CW\-s\fP\fP" By default, \fBsocat\fP terminates when an error occurred to prevent the process from running when some option could not be applied\&. With this option, \fBsocat\fP is sloppy with errors and tries to continue\&. Even with this option, socat will exit on fatals, and will abort connection attempts when security checks failed\&. .IP "\fB\f(CW\-S\fP\fP\f(CW\fP" Changes the set of signals that are caught by \fBsocat\fP just for printing an log message\&. This catching is useful to get the information about the signal into \fBsocat\fPs log, but prevents core dump or other standard actions\&. The default set of these signals is SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGBUS, SIGFPE, SIGSEGV, and SIGTERM; replace this set (0x89de on Linux) with a bitmap (e\&.g\&., SIGFPE has value 8 and its bit is 0x0080)\&. .br Note: Signals SIGHUP, SIGINT, SIGQUIT, SIGUSR1, SIGPIPE, SIGALRM, SIGTERM, and SIGCHLD may be handled specially anyway\&. .IP "\fB\f(CW\-t\fP\fP\f(CW\fP" When one channel has reached EOF, the write part of the other channel is shut down\&. Then, \fBsocat\fP waits [timeval] seconds before terminating\&. Default is 0\&.5 seconds\&. This timeout only applies to addresses where write and read part can be closed independently\&. When during the timeout interval the read part gives EOF, socat terminates without awaiting the timeout\&. .IP "\fB\f(CW\-T\fP\fP\f(CW\fP" Total inactivity timeout: when socat is already in the transfer loop and nothing has happened for [timeval] seconds (no data arrived, no interrupt occurred\&.\&.\&.) then it terminates\&. Useful with protocols like UDP that cannot transfer EOF\&. .IP "\fB\f(CW\-u\fP\fP" Uses unidirectional mode\&. The first address is only used for reading, and the second address is only used for writing (example)\&. .IP "\fB\f(CW\-U\fP\fP" Uses unidirectional mode in reverse direction\&. The first address is only used for writing, and the second address is only used for reading\&. .IP "\fB\f(CW\-g\fP\fP" During address option parsing, don\(cq\&t check if the option is considered useful in the given address environment\&. Use it if you want to force, e\&.g\&., appliance of a socket option to a serial device\&. .IP "\fB\f(CW\-L\fP\fP\f(CW\fP" If lockfile exists, exits with error\&. If lockfile does not exist, creates it and continues, unlinks lockfile on exit\&. .IP "\fB\f(CW\-W\fP\fP\f(CW\fP" If lockfile exists, waits until it disappears\&. When lockfile does not exist, creates it and continues, unlinks lockfile on exit\&. .IP "\fB\f(CW\-4\fP\fP" Use IP version 4 in case the addresses do not implicitly or explicitly specify a version\&. Since version 1\&.8\&.0 the default is no preference\&. .IP "\fB\f(CW\-6\fP\fP" Use IP version 6 in case the addresses do not implicitly or explicitly specify a version\&. .IP "\fB\f(CW\-\-statistics\fP\fP" .IP "\fB\f(CW\-S\fP\fP" Logs transfer statistics (bytes and blocks counters for both directions) before terminating \fBsocat\fP\&. .br See also signal USR1\&. .br This feature is experimental and might change in future versions\&. .PP .SH "ADDRESS SPECIFICATIONS" .PP With the address command line arguments, the user gives \fBsocat\fP instructions and the necessary information for establishing the byte streams\&. .PP An address specification usually consists of an address type keyword, zero or more required address parameters separated by \(cq\&:\(cq\& from the keyword and from each other, and zero or more address options separated by \(cq\&,\(cq\&\&. .PP The 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 omitted: Address specifications starting with a number are assumed to be FD (raw file descriptor) addresses; if a \(cq\&/\(cq\& is found before the first \(cq\&:\(cq\& or \(cq\&,\(cq\&, GOPEN (generic file open) is assumed\&. .PP The required number and type of address parameters depend on the address type\&. E\&.g\&., TCP4 requires a server specification (name or address), and a port specification (number or service name)\&. .PP Zero or more address options may be given with each address\&. They influence the address in some ways\&. Options consist of an option keyword or an option keyword and a value, separated by \(cq\&=\(cq\&\&. Option keywords are case insensitive\&. For filtering the options that are useful with an address type, each option is member of one option group\&. For each address type there is a set of option groups allowed\&. Only options belonging to one of these address groups may be used (except with option \-g)\&. .PP Address specifications following the above schema are also called \fIsingle\fP address specifications\&. Two single addresses can be combined with \(dq\&!!\(dq\& to form a \fIdual\fP type address for one channel\&. Here, the first address is used by \fBsocat\fP for reading data, and the second address for writing data\&. There is no way to specify an option only once for being applied to both single addresses\&. .PP Usually, addresses are opened in read/write mode\&. When an address is part of a dual address specification, or when option \-u or \-U is used, an address might be used only for reading or for writing\&. Considering this is important with some address types\&. .PP With socat version 1\&.5\&.0 and higher, the lexical analysis tries to handle quotes and parenthesis meaningfully and allows escaping of special characters\&. If one of the characters ( { [ \(cq\& is found, the corresponding closing character \- ) } ] \(cq\& \- is looked for; they may also be nested\&. Within these constructs, socats special characters and strings : , !! are not handled specially\&. All those characters and strings can be escaped with \e or within \(dq\&\(dq\& .PP .SH "ADDRESS TYPES" .PP This section describes the available address types with their keywords, parameters, and semantics\&. .PP .IP "\fB\f(CWCREATE:\fP\fP" Opens with \f(CWcreat()\fP and uses the file descriptor for writing\&. This is a write\-only address because a file opened with \f(CWcreat\fP cannot be read from\&. See options \-u and \-U, and dual addresses\&. .br Flags like O_LARGEFILE cannot be applied\&. If you need them use OPEN with options create,create\&. .br must be a valid existing or not existing path\&. If is a named pipe, \f(CWcreat()\fP might block; if refers to a socket, this is an error\&. .br Option groups: FD,REG,NAMED .br Useful options: mode, user, group, unlink\-early, unlink\-late, append .br See also: OPEN, GOPEN .IP .IP "\fB\f(CWDCCP\-CONNECT::\fP\fP (\fB\f(CWDCCP::\fP\fP)" Establishes a DCCP connect to the specified [IP address] and [DCCP service] using IP version 4 or 6 depending on address specification, name resolution, or option pf\&. .br Option groups: FD,SOCKET,IP4,IP6,SCTP,CHILD,RETRY .br Useful options: bind, connect\-timeout, tos, dccp\-set\-ccid, nonblock, sourceport, retry, readbytes .br See also: DCCP4\-CONNECT, DCCP6\-CONNECT, DCCP\-LISTEN, TCP\-CONNECT SCTP\-CONNECT .IP "\fB\f(CWDCCP4\-CONNECT::\fP\fP (\fB\f(CWDCCP4::\fP\fP)" Like DCCP\-CONNECT, but only supports IPv4 protocol\&. .br Option groups: FD,SOCKET,IP4,DCCP,CHILD,RETRY .br .IP "\fB\f(CWDCCP6\-CONNECT::\fP\fP (\fB\f(CWDCCP6::\fP\fP)" Like DCCP\-CONNECT, but only supports IPv6 protocol\&. .br Option groups: FD,SOCKET,IP6,DCCP,CHILD,RETRY .br .IP .IP "\fB\f(CWDCCP\-LISTEN:\fP\fP (\fB\f(CWDCCP\-L:\fP\fP)" Listens on [DCCP service] and accepts an DCCP connection\&. The IP version is 4 or the one specified with address option pf, socat option (\-4, \-6), or environment variable SOCAT_DEFAULT_LISTEN_IP\&. Note that opening this address usually blocks until a client connects\&. .br Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6,DCCP,RETRY .br Useful options: fork, bind, range, max\-children, backlog, accept\-timeout, dccp\-set\-sid, su, reuseaddr, retry .br See also: DCCP4\-LISTEN, DCCP6\-LISTEN, TCP\-LISTEN, SCTP\-LISTEN, DCCP\-CONNECT .IP "\fB\f(CWDCCP4\-LISTEN:\fP\fP (\fB\f(CWDCCP4\-L:\fP\fP)" Like DCCP\-LISTEN, but only supports IPv4 protocol\&. .br Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,DCCP,RETRY .br .IP "\fB\f(CWDCCP6\-LISTEN:\fP\fP (\fB\f(CWDCCP6\-L:\fP\fP)" Like DCCP\-LISTEN, but only supports IPv6 protocol\&. .br Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP6,DCCP,RETRY .br .IP .IP "\fB\f(CWEXEC:\fP\fP" Forks a sub process that establishes communication with its parent process and invokes the specified program with \f(CWexecvp()\fP \&. is a simple command with arguments separated by single spaces\&. If the program name contains a \(cq\&/\(cq\&, the part after the last \(cq\&/\(cq\& is taken as ARGV[0]\&. If the program name is a relative path, the \f(CWexecvp()\fP semantics for finding the program via \f(CW$PATH\fP apply\&. After successful program start, \fBsocat\fP writes data to stdin of the process and reads from its stdout using a UNIX domain socket generated by \f(CWsocketpair()\fP per default\&. (example) .br Option groups: FD,SOCKET,EXEC,FORK,TERMIOS .br Useful options: path, fdin, fdout, chroot, su, su\-d, nofork, socktype, pty, stderr, ctty, setsid, pipes, umask, login, sigint, sigquit, netns .br See also: SYSTEM,SHELL .IP "\fB\f(CWFD:\fP\fP" Uses the file descriptor \&. It must already exist as valid UN*X file descriptor\&. .br Option groups: FD (TERMIOS,REG,SOCKET) .br See also: STDIO, STDIN, STDOUT, STDERR .IP "\fB\f(CWGOPEN:\fP\fP" (Generic open) This address type tries to handle any file system entry except directories usefully\&. may be a relative or absolute path\&. If it already exists, its type is checked\&. In case of a UNIX domain socket, \fBsocat\fP connects; if connecting fails, \fBsocat\fP assumes a datagram socket and uses \f(CWsendto()\fP calls\&. If the entry is not a socket, \fBsocat\fP opens it applying the \f(CWO_APPEND\fP flag\&. If it does not exist, it is opened with flag \f(CWO_CREAT\fP as a regular file (example)\&. .br Option groups: FD,REG,SOCKET,NAMED,OPEN .br See also: OPEN, CREATE, UNIX\-CONNECT .IP .IP "\fB\f(CWIP\-SENDTO::\fP\fP" Opens a raw IP socket\&. Depending on host specification or option pf, IP protocol version 4 or 6 is used\&. It uses to send packets to [IP address] and receives packets from host, ignores packets from other hosts\&. Protocol 255 uses the raw socket with the IP header being part of the data\&. .br Option groups: FD,SOCKET,IP4,IP6 .br Useful options: pf, ttl .br See also: IP4\-SENDTO, IP6\-SENDTO, IP\-RECVFROM, IP\-RECV, UDP\-SENDTO, UNIX\-SENDTO .IP "\fB\f(CWINTERFACE:\fP\fP" Communicates with a network connected on an interface using raw packets including link level data\&. is the name of the network interface\&. Currently only available on Linux\&. .br Option groups: FD,SOCKET .br Useful options: pf, type .br See also: ip\-recv .IP "\fB\f(CWIP4\-SENDTO::\fP\fP" Like IP\-SENDTO, but always uses IPv4\&. .br Option groups: FD,SOCKET,IP4 .br .IP "\fB\f(CWIP6\-SENDTO::\fP\fP" Like IP\-SENDTO, but always uses IPv6\&. .br Option groups: FD,SOCKET,IP6 .br .IP .IP "\fB\f(CWIP\-DATAGRAM:
:\fP\fP" Sends outgoing data to the specified address which may in particular be a broadcast or multicast address\&. Packets arriving on the local socket are checked if their source addresses match RANGE or TCPWRAP options\&. This address type can for example be used for implementing symmetric or asymmetric broadcast or multicast communications\&. .br Option groups: FD, SOCKET, IP4, IP6, RANGE .br Useful options: bind, range, tcpwrap, broadcast, ip\-multicast\-loop, ip\-multicast\-ttl, ip\-multicast\-if, ip\-add\-membership, ip\-add\-source\-membership, ipv6\-join\-group, ipv6\-join\-source\-group, ttl, tos, pf .br See also: IP4\-DATAGRAM, IP6\-DATAGRAM, IP\-SENDTO, IP\-RECVFROM, IP\-RECV, UDP\-DATAGRAM .IP "\fB\f(CWIP4\-DATAGRAM::\fP\fP" Like IP\-DATAGRAM, but always uses IPv4\&. (example) .br Option groups: FD,SOCKET,IP4,RANGE .br .IP "\fB\f(CWIP6\-DATAGRAM::\fP\fP" Like IP\-DATAGRAM, but always uses IPv6\&. Please note that IPv6 does not know broadcasts\&. .br Option groups: FD,SOCKET,IP6,RANGE .br .IP .IP "\fB\f(CWIP\-RECVFROM:\fP\fP" Opens a raw IP socket of \&. Depending on option pf, IP protocol version 4 or 6 is used\&. It receives one packet from an unspecified peer and may send one or more answer packets to that peer\&. This mode is particularly useful with fork option where each arriving packet \- from arbitrary peers \- is handled by its own sub process\&. This allows a behaviour similar to typical UDP based servers like ntpd or named\&. .br Please note that the reply packets might be fetched as incoming traffic when sender and receiver IP address are identical because there is no port number to distinguish the sockets\&. .br This address works well with IP\-SENDTO address peers (see above)\&. Protocol 255 uses the raw socket with the IP header being part of the data\&. .br See the note about RECVFROM addresses\&. .br Option groups: FD,SOCKET,IP4,IP6,CHILD,RANGE .br Useful options: pf, fork, range, ttl, broadcast .br See also: IP4\-RECVFROM, IP6\-RECVFROM, IP\-SENDTO, IP\-RECV, UDP\-RECVFROM, UNIX\-RECVFROM .IP "\fB\f(CWIP4\-RECVFROM:\fP\fP" Like IP\-RECVFROM, but always uses IPv4\&. .br Option groups: FD,SOCKET,IP4,CHILD,RANGE .br .IP "\fB\f(CWIP6\-RECVFROM:\fP\fP" Like IP\-RECVFROM, but always uses IPv6\&. .br Option groups: FD,SOCKET,IP6,CHILD,RANGE .br .IP .IP "\fB\f(CWIP\-RECV:\fP\fP" Opens a raw IP socket of \&. Depending on option pf, IP protocol version 4 or 6 is used\&. It receives packets from multiple unspecified peers and merges the data\&. No replies are possible, this is a read\-only address, see options \-u and \-U, and dual addresses\&. It can be, e\&.g\&., addressed by socat IP\-SENDTO address peers\&. Protocol 255 uses the raw socket with the IP header being part of the data\&. .br Option groups: FD,SOCKET,IP4,IP6,RANGE .br Useful options: pf, range .br See also: IP4\-RECV, IP6\-RECV, IP\-SENDTO, IP\-RECVFROM, UDP\-RECV, UNIX\-RECV .IP "\fB\f(CWIP4\-RECV:\fP\fP" Like IP\-RECV, but always uses IPv4\&. .br Option groups: FD,SOCKET,IP4,RANGE .br .IP "\fB\f(CWIP6\-RECV:\fP\fP" Like IP\-RECV, but always uses IPv6\&. .br Option groups: FD,SOCKET,IP6,RANGE .br .IP .IP "\fB\f(CWOPEN:\fP\fP" Opens using the \f(CWopen()\fP system call (example)\&. This operation fails on UNIX domain sockets\&. .br Note: This address type is rarely useful in bidirectional mode\&. .br Option groups: FD,REG,NAMED,OPEN .br Useful options: creat, excl, noatime, nofollow, append, rdonly, wronly, lock, readbytes, ignoreeof .br See also: CREATE, GOPEN, UNIX\-CONNECT .IP .IP "\fB\f(CWOPENSSL::\fP\fP" Tries to establish a SSL connection to [TCP service] on [IP address] using TCP/IP version 4 or 6 depending on address specification, name resolution, or option pf\&. .br NOTE: Up to version 1\&.7\&.2\&.4 the server certificate was only checked for validity against the system certificate store or cafile or capath, but not for match with the server\(cq\&s name or its IP address\&. Since version 1\&.7\&.3\&.0 socat checks the peer certificate for match with the parameter or the value of the openssl\-commonname option\&. Socat tries to match it against the certificates subject commonName, and the certificates extension subjectAltName DNS names\&. Wildcards in the certificate are supported\&. .br Option groups: FD,SOCKET,IP4,IP6,TCP,OPENSSL,RETRY .br Useful options: min\-proto\-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, bind, pf, connect\-timeout, sourceport, retry .br See also: OPENSSL\-LISTEN, TCP .IP .IP "\fB\f(CWOPENSSL\-LISTEN:\fP\fP" Listens on tcp [TCP service]\&. The IP version is 4 or the one specified with pf\&. When a connection is accepted, this address behaves as SSL server\&. .br Note: You probably want to use the certificate option with this address\&. .br NOTE: The client certificate is only checked for validity against cafile or capath, but not for match with the client\(cq\&s name or its IP address! .br Option groups: FD,SOCKET,IP4,IP6,TCP,LISTEN,OPENSSL,CHILD,RANGE,RETRY .br Useful options: pf, min\-proto\-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, fork, bind, range, tcpwrap, su, reuseaddr, retry .br See also: OPENSSL, TCP\-LISTEN .IP .IP "\fB\f(CWOPENSSL\-DTLS\-CLIENT::\fP\fP" Tries to establish a DTLS connection to [UDP service] on [IP address] using UDP/IP version 4 or 6 depending on address specification, name resolution, or option pf\&. .br \fBSocat\fP checks the peer certificates subjectAltName or commonName against the addresses option openssl\-commonname or the host name\&. Wildcards in the certificate are supported\&. .br Use \fBsocat\fP option \-b to make datagrams small enough to fit with overhead on the network\&. Use option \-T to prevent indefinite hanging when peer went down quietly\&. .br Option groups: FD,SOCKET,IP4,IP6,OPENSSL,RETRY .br Useful options: min\-proto\-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, bind, pf, sourceport, retry, rcvtimeo .br See also: OPENSSL\-DTLS\-SERVER, OPENSSL\-CONNECT, UDP\-CONNECT .IP .IP "\fB\f(CWOPENSSL\-DTLS\-SERVER:\fP\fP" Listens on UDP [UDP service]\&. The IP version is 4 or the one specified with pf\&. When a connection is accepted, this address behaves as DTLS server\&. .br Note: You probably want to use the certificate option with this address\&. .br NOTE: The client certificate is only checked for validity against cafile or capath, but not for match with the client\(cq\&s name or its IP address! Use \fBsocat\fP option \-b to make datagrams small enough to fit with overhead on the network\&. Use option \-T to prevent indefinite hanging when peer went down quietly\&. .br Option groups: FD,SOCKET,IP4,IP6,LISTEN,OPENSSL,CHILD,RANGE,RETRY .br Useful options: pf, min\-proto\-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, fork, bind, range, tcpwrap, su, reuseaddr, retry .br rcvtimeo .br See also: OPENSSL\-DTLS\-CLIENT, OPENSSL\-LISTEN, UDP\-LISTEN .IP .IP "\fB\f(CWPIPE:\fP\fP" If already exists, it is opened\&. If it does not exist, a named pipe is created and opened\&. Beginning with socat version 1\&.4\&.3, the named pipe is removed when the address is closed (but see option unlink\-close .br Note: When a pipe is used for both reading and writing, it works as echo service\&. .br Note: When a pipe is used for both reading and writing, and socat tries to write more bytes than the pipe can buffer (Linux 2\&.4: 2048 bytes), socat might block\&. Consider using socat option, e\&.g\&., \f(CW\-b 2048\fP .br Option groups: FD,NAMED,OPEN .br Useful options: rdonly, nonblock, group, user, mode, unlink\-early .br See also: unnamed pipe .IP "\fB\f(CWPIPE\fP\fP" Creates an unnamed pipe and uses it for reading and writing\&. It works as an echo, because everything written to it appeares immediately as read data\&. .br Note: When socat tries to write more bytes than the pipe can queue (Linux 2\&.4: 2048 bytes), socat might block\&. Consider, e\&.g\&., using option \f(CW\-b 2048\fP .br Option groups: FD .br See also: named pipe, SOCKETPAIR .IP "\fB\f(CWSOCKETPAIR\fP\fP" Creates a socketpair and uses it for reading and writing\&. It works as an echo, because everything written to it appeares immediately as read data\&. The default socket type is datagram, so it keeps packet boundaries\&. .br Option groups: FD .br Useful options: socktype .br See also: unnamed pipe .IP .IP "\fB\f(CWPOSIXMQ\-READ:/\fP\fP" Opens the specified POSIX message queue and reads messages (packets)\&. It keeps the boundaries\&. .br This is a read\-only address, see options \-u and \-U and dual addresses\&. .br \fBSocat\fP provides this address type only on Linux because POSIX MQ is based on UNIX filedescriptors there\&. .br This feature is new in version 1\&.8\&.0\&.0 and might change in the future, therefore it is experimental\&. .br Useful options: posixmq\-priority, unlink\-early, unlink\-close .IP .IP "\fB\f(CWPOSIXMQ\-RECEIVE:/\fP\fP" .IP "\fB\f(CWPOSIXMQ\-RECV:/\fP\fP" Opens the specified POSIX message queue and reads one message (packet)\&. .br This is a read\-only address\&. See POSIXMQ\-READ for more info\&. .br Example: POSIX MQ recv with fork .br This feature is experimental\&. .br Useful options: posixmq\-priority, fork, max\-children, unlink\-early, unlink\-close .IP .IP "\fB\f(CWPOSIXMQ\-SEND:/\fP\fP" Opens the specified POSIX message queue and writes messages (packets)\&. .br This is a write\-only address\&. See POSIXMQ\-READ for more info\&. .br (Example) .br This feature is experimental\&. .br Useful options: posixmq\-priority, fork, max\-children, unlink\-early, unlink\-close .IP .IP "\fB\f(CWPOSIXMQ\-BIDIRECTIONAL:/mqueue\fP\fP" Opens the specified POSIX message queue and writes and reads messages (packet)\&. This is probably rarely useful but has been implemented for functional completeness\&. .IP .IP "\fB\f(CWPROXY:::\fP\fP" Connects to an HTTP proxy server on port 8080 using TCP/IP version 4 or 6 depending on address specification, name resolution, or option pf, and sends a CONNECT request for hostname:port\&. If the proxy grants access and succeeds to connect to the target, data transfer between socat and the target can start (example)\&. Note that the traffic need not be HTTP but can be an arbitrary protocol\&. .br Option groups: FD,SOCKET,IP4,IP6,TCP,HTTP,RETRY .br Useful options: proxyport, ignorecr, proxyauth, resolve, crnl, bind, connect\-timeout, mss, sourceport, retry .br See also: SOCKS, TCP .IP "\fB\f(CWPTY\fP\fP" Generates a pseudo terminal (pty) and uses its master side\&. Another process may open the pty\(cq\&s slave side using it like a serial line or terminal\&. (example)\&. If both the ptmx and the openpty mechanisms are available, ptmx is used (POSIX)\&. .br Option groups: FD,NAMED,PTY,TERMIOS .br Useful options: link, openpty, wait\-slave, mode, user, group .br See also: UNIX\-LISTEN, PIPE, EXEC, SYSTEM, SHELL .IP "\fB\f(CWREADLINE\fP\fP" Uses GNU readline and history on stdio to allow editing and reusing input lines (example)\&. This requires the GNU readline and history libraries\&. Note that stdio should be a (pseudo) terminal device, otherwise readline does not seem to work\&. .br Option groups: FD,READLINE,TERMIOS .br Useful options: history, noecho .br See also: STDIO .IP "\fB\f(CWSCTP\-CONNECT::\fP\fP" Establishes an SCTP stream connection to the specified [IP address] and [TCP service] using IP version 4 or 6 depending on address specification, name resolution, or option pf\&. .br Option groups: FD,SOCKET,IP4,IP6,SCTP,CHILD,RETRY .br Useful options: bind, pf, connect\-timeout, tos, mtudiscover, sctp\-maxseg, sctp\-nodelay, nonblock, sourceport, retry, readbytes .br See also: SCTP4\-CONNECT, SCTP6\-CONNECT, SCTP\-LISTEN, TCP\-CONNECT .IP "\fB\f(CWSCTP4\-CONNECT::\fP\fP" Like SCTP\-CONNECT, but only supports IPv4 protocol\&. .br Option groups: FD,SOCKET,IP4,SCTP,CHILD,RETRY .br .IP "\fB\f(CWSCTP6\-CONNECT::\fP\fP" Like SCTP\-CONNECT, but only supports IPv6 protocol\&. .br Option groups: FD,SOCKET,IP6,SCTP,CHILD,RETRY .br .IP "\fB\f(CWSCTP\-LISTEN:\fP\fP" Listens on [TCP service] and accepts an SCTP connection\&. The IP version is 4 or the one specified with address option pf, socat option (\-4, \-6), or environment variable SOCAT_DEFAULT_LISTEN_IP\&. Note that opening this address usually blocks until a client connects\&. .br Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6,SCTP,RETRY .br Useful options: crnl, fork, bind, range, tcpwrap, pf, max\-children, backlog, accept\-timeout, sctp\-maxseg, sctp\-nodelay, su, reuseaddr, retry .br See also: SCTP4\-LISTEN, SCTP6\-LISTEN, TCP\-LISTEN, SCTP\-CONNECT .IP "\fB\f(CWSCTP4\-LISTEN:\fP\fP" Like SCTP\-LISTEN, but only supports IPv4 protocol\&. .br Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,SCTP,RETRY .br .IP "\fB\f(CWSCTP6\-LISTEN:\fP\fP" Like SCTP\-LISTEN, but only supports IPv6 protocol\&. .br Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP6,SCTP,RETRY .br .IP .IP "\fB\f(CWSOCKET\-CONNECT:::\fP\fP" Creates a stream socket using the first and second given socket parameters and \f(CWSOCK_STREAM\fP (see man socket(2)) and connects to the remote\-address\&. The two socket parameters have to be specified by int numbers\&. 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 components\&. .br Please note that you can \- beyond the options of the specified groups \- also use options of higher level protocols when you apply socat option \-g\&. .br Option groups: FD,SOCKET,CHILD,RETRY .br Useful options: bind, setsockopt, .br See also: TCP, UDP\-CONNECT, UNIX\-CONNECT, SOCKET\-LISTEN, SOCKET\-SENDTO .IP "\fB\f(CWSOCKET\-DATAGRAM::::\fP\fP" Creates a datagram socket using the first three given socket parameters (see man socket(2)) and sends outgoing data to the remote\-address\&. The three socket parameters have to be specified by int numbers\&. 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 components\&. .br Please note that you can \- beyond the options of the specified groups \- also use options of higher level protocols when you apply socat option \-g\&. .br Option groups: FD,SOCKET,RANGE .br Useful options: bind, range, setsockopt, .br See also: UDP\-DATAGRAM, IP\-DATAGRAM, SOCKET\-SENDTO, SOCKET\-RECV, SOCKET\-RECVFROM .IP "\fB\f(CWSOCKET\-LISTEN:::\fP\fP" Creates a stream socket using the first and second given socket parameters and \f(CWSOCK_STREAM\fP (see man socket(2)) and waits for incoming connections on local\-address\&. The two socket parameters have to be specified by int numbers\&. Consult your OS documentation and include files to find the appropriate values\&. The local\-address must be the data representation of a sockaddr structure without sa_family and (BSD) sa_len components\&. .br Please note that you can \- beyond the options of the specified groups \- also use options of higher level protocols when you apply socat option \-g\&. .br Option groups: FD,SOCKET,LISTEN,RANGE,CHILD,RETRY .br Useful options: setsockopt, setsockopt\-listen, .br See also: TCP, UDP\-CONNECT, UNIX\-CONNECT, SOCKET\-LISTEN, SOCKET\-SENDTO, SOCKET\-SENDTO .IP "\fB\f(CWSOCKET\-RECV::::\fP\fP" Creates a socket using the three given socket parameters (see man socket(2)) and binds it to \&. Receives arriving data\&. The three parameters have to be specified by int numbers\&. Consult your OS documentation and include files to find the appropriate values\&. The local\-address must be the data representation of a sockaddr structure without sa_family and (BSD) sa_len components\&. .br Option groups: FD,SOCKET,RANGE .br Useful options: range, setsockopt, setsockopt\-listen .br See also: UDP\-RECV, IP\-RECV, UNIX\-RECV, SOCKET\-DATAGRAM, SOCKET\-SENDTO, SOCKET\-RECVFROM .IP "\fB\f(CWSOCKET\-RECVFROM::::\fP\fP" Creates a socket using the three given socket parameters (see man socket(2)) and binds it to \&. Receives arriving data and sends replies back to the sender\&. The first three parameters have to be specified as int numbers\&. Consult your OS documentation and include files to find the appropriate values\&. The local\-address must be the data representation of a sockaddr structure without sa_family and (BSD) sa_len components\&. .br See the note about RECVFROM addresses\&. .br Option groups: FD,SOCKET,CHILD,RANGE .br Useful options: fork, range, setsockopt, setsockopt\-listen .br See also: UDP\-RECVFROM, IP\-RECVFROM, UNIX\-RECVFROM, SOCKET\-DATAGRAM, SOCKET\-SENDTO, SOCKET\-RECV .IP "\fB\f(CWSOCKET\-SENDTO::::\fP\fP" Creates a socket using the three given socket parameters (see man socket(2))\&. Sends outgoing data to the given address and receives replies\&. The three parameters have to be specified as int numbers\&. 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 components\&. .br Option groups: FD,SOCKET .br Useful options: bind, setsockopt, setsockopt\-listen .br See also: UDP\-SENDTO, IP\-SENDTO, UNIX\-SENDTO, SOCKET\-DATAGRAM, SOCKET\-RECV SOCKET\-RECVFROM .IP "\fB\f(CWACCEPT\-FD:\fP\fP" Expects a listening socket in and accepts one or (with option fork) more connections\&. This address type is useful under systemd control with \(dq\&inetd mode\(dq\&\&. .br Example: (example) .br Option groups: FD, SOCKET, TCP, CHILD, RETRY .br Useful options: fork, range, sourceport, lowport, tcpwrap .IP "\fB\f(CWSOCKS4:::\fP\fP" Connects via [IP address] to [IPv4 address] on [TCP service], using socks version 4 protocol over IP version 4 or 6 depending on address specification, name resolution, or option pf (example)\&. .br Option groups: FD,SOCKET,IP4,IP6,TCP,SOCKS4,RETRY .br Useful options: socksuser, socksport, sourceport, pf, retry .br See also: SOCKS5, SOCKS4A, PROXY, TCP .IP .IP "\fB\f(CWSOCKS4A:::\fP\fP" like SOCKS4, but uses socks protocol version 4a, thus leaving host name resolution to the socks server\&. .br Option groups: FD,SOCKET,IP4,IP6,TCP,SOCKS4,RETRY .br .IP .IP "\fB\f(CWSOCKS5\-CONNECT::::\fP\fP" Connects via [IP address] to [IPv4 address] on [TCP service], using socks version 5 protocol over TCP\&. Currently no authentication mechanism is provided\&. .br This address type is experimental\&. .br Option groups: FD, SOCKET, IP4, IP6, TCP, CHILD, RETRY .br Useful options: sourceport, pf, retry .br See also: SOCKS5\-LISTEN, SOCKS4, SOCKS4A, PROXY, TCP .IP .IP "\fB\f(CWSOCKS5\-LISTEN::::\fP\fP" Connects to [IP address] using socks version 5 protocol over TCP and makes it listen for incoming connections on [TCP service], binding to <\-listen\-host> [IPv4 address] Currently not authentication mechanism is provided\&. This address type is experimental\&. Option groups: FD, SOCKET, IP4, IP6, TCP, CHILD, RETRY .br Useful options: sourceport, pf, retry .br See also: SOCKS5\-CONNECT, .IP .IP "\fB\f(CWSTDERR\fP\fP" Uses file descriptor 2\&. .br This is a write\-only address, see options \-u and \-U, and dual addresses\&. .br Option groups: FD (TERMIOS,REG,SOCKET) .br See also: FD .IP "\fB\f(CWSTDIN\fP\fP" Uses file descriptor 0\&. .br This is a read\-only address, see options \-u and \-U, and dual addresses\&. .br Option groups: FD (TERMIOS,REG,SOCKET) .br Useful options: readbytes .br See also: FD .IP "\fB\f(CWSTDIO\fP\fP" Uses file descriptor 0 for reading, and 1 for writing\&. .br Option groups: FD (TERMIOS,REG,SOCKET) .br Useful options: readbytes .br See also: FD .IP "\fB\f(CWSTDOUT\fP\fP" Uses file descriptor 1\&. .br This is a write\-only address, see options \-u and \-U, and dual addresses\&. .br Option groups: FD (TERMIOS,REG,SOCKET) .br See also: FD .IP "\fB\f(CWSHELL:\fP\fP" Forks a sub process that establishes communication with its parent process and invokes the specified program with the configured shell ($SHELL)\&. Note that [string] must not contain \(cq\&,\(cq\& or \(dq\&!!\(dq\&, and that shell meta characters may have to be protected\&. After successful program start, \fBsocat\fP writes data to stdin of the process and reads from its stdout\&. .br Option groups: FD,SOCKET,EXEC,FORK,TERMIOS .br Useful options: path, fdin, fdout, chroot, su, su\-d, nofork, socktype, pty, stderr, ctty, setsid, pipes, umask, sigint, sigquit .br See also: EXEC, SYSTEM .IP "\fB\f(CWSYSTEM:\fP\fP" Forks a sub process that establishes communication with its parent process and invokes the specified program with \f(CWsystem()\fP \&. Please note that [string] must not contain \(cq\&,\(cq\& or \(dq\&!!\(dq\&, and that shell meta characters may have to be protected\&. After successful program start, \fBsocat\fP writes data to stdin of the process and reads from its stdout\&. .br Option groups: FD,SOCKET,EXEC,FORK,TERMIOS .br Useful options: path, fdin, fdout, chroot, su, su\-d, nofork, socktype, pty, stderr, ctty, setsid, pipes, umask, sigint, sigquit, netns .br See also: EXEC, SHELL .IP "\fB\f(CWTCP::\fP\fP" Connects to [TCP service] on [IP address] using TCP/IP version 4 or 6 depending on address specification, name resolution, or option pf\&. .br Option groups: FD,SOCKET,IP4,IP6,TCP,RETRY .br Useful options: connect\-timeout, retry, sourceport, netns, crnl, bind, pf, tos, mtudiscover, mss, nodelay, nonblock, readbytes .br See also: TCP4, TCP6, TCP\-LISTEN, UDP, SCTP\-CONNECT, UNIX\-CONNECT .IP "\fB\f(CWTCP4::\fP\fP" Like TCP, but only supports IPv4 protocol (example)\&. .br Option groups: FD,SOCKET,IP4,TCP,RETRY .br .IP "\fB\f(CWTCP6::\fP\fP" Like TCP, but only supports IPv6 protocol\&. .br Option groups: FD,SOCKET,IP6,TCP,RETRY .br .IP "\fB\f(CWTCP\-LISTEN:\fP\fP" Listens on [TCP service] and accepts a TCP/IP connection\&. The IP version is 4 or the one specified with address option pf, socat option (\-4, \-6), or environment variable SOCAT_DEFAULT_LISTEN_IP\&. Note that opening this address usually blocks until a client connects\&. .br Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6,TCP,RETRY .br Useful options: crnl, fork, bind, range, tcpwrap, pf, max\-children, backlog, accept\-timeout, mss, su, reuseaddr, retry, cool\-write .br See also: TCP4\-LISTEN, TCP6\-LISTEN, UDP\-LISTEN, SCTP\-LISTEN, UNIX\-LISTEN, OPENSSL\-LISTEN, TCP\-CONNECT .IP "\fB\f(CWTCP4\-LISTEN:\fP\fP" Like TCP\-LISTEN, but only supports IPv4 protocol (example)\&. .br Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,TCP,RETRY .br .IP "\fB\f(CWTCP6\-LISTEN:\fP\fP" Like TCP\-LISTEN, but only supports IPv6 protocol\&. .br Additional useful option: ipv6only .br Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP6,TCP,RETRY .br .IP "\fB\f(CWTUN[:/]\fP\fP" Creates a Linux TUN/TAP device and optionally assignes it the address and netmask given by the parameters\&. The resulting network interface is almost ready for use by other processes; socat serves its \(dq\&wire side\(dq\&\&. This address requires read and write access to the tunnel cloning device, usually \f(CW/dev/net/tun\fP , as well as permission to set some \f(CWioctl()s\fP\&. \fBOption iff\-up is required to immediately activate the interface!\fP .br Note: If you intend to transfer packets between two Socat \(dq\&wire sides\(dq\& you need a protocol that keeps packet boundaries, e\&.g\&.UDP; TCP might work with option nodelay\&. .br Option groups: FD,NAMED,OPEN,TUN .br Useful options: iff\-up, tun\-device, tun\-name, tun\-type, iff\-no\-pi, netns .br See also: ip\-recv .IP .IP "\fB\f(CWUDP::\fP\fP" Connects to [UDP service] on [IP address] using UDP/IP version 4 or 6 depending on address specification, name resolution, or option pf\&. .br Please note that, due to UDP protocol properties, no real connection is established; data has to be sent for `connecting\(cq\& to the server, and no end\-of\-file condition can be transported\&. .br Option groups: FD,SOCKET,IP4,IP6 .br Useful options: ttl, tos, bind, sourceport, pf .br See also: UDP4, UDP6, UDP\-LISTEN, TCP, IP .IP "\fB\f(CWUDP4::\fP\fP" Like UDP, but only supports IPv4 protocol\&. .br Option groups: FD,SOCKET,IP4 .br .IP "\fB\f(CWUDP6::\fP\fP" Like UDP, but only supports IPv6 protocol\&. .br Option groups: FD,SOCKET,IP6 .br .IP "\fB\f(CWUDP\-DATAGRAM:
:\fP\fP" Sends outgoing data to the specified address which may in particular be a broadcast or multicast address\&. Packets arriving on the local socket are checked for the correct remote port only when option sourceport is used (this is a change with \fBSocat\fP version 1\&.7\&.4\&.0) and if their source addresses match RANGE or TCPWRAP options\&. This address type can for example be used for implementing symmetric or asymmetric broadcast or multicast communications\&. .br Option groups: FD,SOCKET,IP4,IP6,RANGE .br Useful options: bind, range, tcpwrap, broadcast, ip\-multicast\-loop, ip\-multicast\-ttl, ip\-multicast\-if, ip\-add\-membership, ip\-add\-source\-membership, ipv6\-join\-group, ipv6\-join\-source\-group, ttl, tos, sourceport, pf .br See also: UDP4\-DATAGRAM, UDP6\-DATAGRAM, UDP\-SENDTO, UDP\-RECVFROM, UDP\-RECV, UDP\-CONNECT, UDP\-LISTEN, IP\-DATAGRAM .IP "\fB\f(CWUDP4\-DATAGRAM:
:\fP\fP" Like UDP\-DATAGRAM, but only supports IPv4 protocol (example1, example2)\&. .br Option groups: FD,SOCKET,IP4, RANGE .IP "\fB\f(CWUDP6\-DATAGRAM:
:\fP\fP" Like UDP\-DATAGRAM, but only supports IPv6 protocol\&. .br Option groups: FD,SOCKET,IP6,RANGE .IP "\fB\f(CWUDP\-LISTEN:\fP\fP" Waits for a UDP/IP packet arriving on [UDP service] and `connects\(cq\& back to sender\&. The accepted IP version is 4 or the one specified with option pf\&. Please note that, due to UDP protocol properties, no real connection is established; data has to arrive from the peer first, and no end\-of\-file condition can be transported\&. Note that opening this address usually blocks until a client connects\&. .br Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6 .br Useful options: fork, bind, range, pf .br See also: UDP, UDP4\-LISTEN, UDP6\-LISTEN, TCP\-LISTEN .IP "\fB\f(CWUDP4\-LISTEN:\fP\fP" Like UDP\-LISTEN, but only support IPv4 protocol\&. .br Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4 .br .IP "\fB\f(CWUDP6\-LISTEN:\fP\fP" Like UDP\-LISTEN, but only support IPv6 protocol\&. .br Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP6 .br .IP "\fB\f(CWUDP\-SENDTO::\fP\fP" Communicates with the specified peer socket, defined by [UDP service] on [IP address], using UDP/IP version 4 or 6 depending on address specification, name resolution, or option pf\&. It sends packets to and receives packets from that peer socket only\&. This address effectively implements a datagram client\&. It works well with socat UDP\-RECVFROM and UDP\-RECV address peers\&. .br Option groups: FD,SOCKET,IP4,IP6 .br Useful options: ttl, tos, bind, sourceport, pf .br See also: UDP4\-SENDTO, UDP6\-SENDTO, UDP\-RECVFROM, UDP\-RECV, UDP\-CONNECT, UDP\-LISTEN, IP\-SENDTO .IP "\fB\f(CWUDP4\-SENDTO::\fP\fP" Like UDP\-SENDTO, but only supports IPv4 protocol\&. .br Option groups: FD,SOCKET,IP4 .IP "\fB\f(CWUDP6\-SENDTO::\fP\fP" Like UDP\-SENDTO, but only supports IPv6 protocol\&. .br Option groups: FD,SOCKET,IP6 .IP .IP "\fB\f(CWUDP\-RECVFROM:\fP\fP" Creates a UDP socket on [UDP service] using UDP/IP version 4 or 6 depending on option pf\&. It receives one packet from an unspecified peer and may send one or more answer packets to that peer\&. This mode is particularly useful with fork option where each arriving packet \- from arbitrary peers \- is handled by its own sub process\&. This allows a behaviour similar to typical UDP based servers like ntpd or named\&. This address works well with socat UDP\-SENDTO address peers\&. .br Note: When the second address fails before entering the transfer loop the packet is dropped\&. Use option retry or forever on the second address to avoid data loss\&. .br Option groups: FD,SOCKET,IP4,IP6,CHILD,RANGE .br Useful options: fork, ttl, tos, bind, sourceport, pf .br See also: UDP4\-RECVFROM, UDP6\-RECVFROM, UDP\-SENDTO, UDP\-RECV, UDP\-CONNECT, UDP\-LISTEN, IP\-RECVFROM, UNIX\-RECVFROM .IP "\fB\f(CWUDP4\-RECVFROM:\fP\fP" Like UDP\-RECVFROM, but only supports IPv4 protocol\&. .br Option groups: FD,SOCKET,IP4,CHILD,RANGE .IP "\fB\f(CWUDP6\-RECVFROM:\fP\fP" Like UDP\-RECVFROM, but only supports IPv6 protocol\&. .br Option groups: FD,SOCKET,IP6,CHILD,RANGE .IP .IP "\fB\f(CWUDP\-RECV:\fP\fP" Creates a UDP socket on [UDP service] using UDP/IP version 4 or 6 depending on option pf\&. It receives packets from multiple unspecified peers and merges the data\&. No replies are possible\&. It works well with, e\&.g\&., socat UDP\-SENDTO address peers; it behaves similar to a syslog server\&. .br This is a read\-only address, see options \-u and \-U, and dual addresses\&. .br Note: if you need the fork option, use UDP\-RECVFROM in unidirectional mode (with option \-u) instead\&. .br Option groups: FD,SOCKET,IP4,IP6,RANGE .br Useful options: pf, bind, sourceport, ttl, tos .br See also: UDP4\-RECV, UDP6\-RECV, UDP\-SENDTO, UDP\-RECVFROM, UDP\-CONNECT, UDP\-LISTEN, IP\-RECV, UNIX\-RECV .IP "\fB\f(CWUDP4\-RECV:\fP\fP" Like UDP\-RECV, but only supports IPv4 protocol\&. .br Option groups: FD,SOCKET,IP4,RANGE .IP "\fB\f(CWUDP6\-RECV:\fP\fP" Like UDP\-RECV, but only supports IPv6 protocol\&. .br Option groups: FD,SOCKET,IP6,RANGE .IP .IP "\fB\f(CWUDPLITE\-CONNECT::\fP\fP" .IP "\fB\f(CWUDPLITE4\-CONNECT::\fP\fP" .IP "\fB\f(CWUDPLITE6\-CONNECT::\fP\fP" .IP "\fB\f(CWUDPLITE\-DATAGRAM:
:\fP\fP" .IP "\fB\f(CWUDPLITE4\-DATAGRAM:
:\fP\fP" .IP "\fB\f(CWUDPLITE6\-DATAGRAM:
:\fP\fP" .IP "\fB\f(CWUDPLITE\-LISTEN:\fP\fP" .IP "\fB\f(CWUDPLITE4\-LISTEN:\fP\fP" .IP "\fB\f(CWUDPLITE6\-LISTEN:\fP\fP" .IP "\fB\f(CWUDPLITE\-SENDTO::\fP\fP" .IP "\fB\f(CWUDPLITE4\-SENDTO::\fP\fP" .IP "\fB\f(CWUDPLITE6\-SENDTO::\fP\fP" .IP "\fB\f(CWUDPLITE\-RECVFROM:\fP\fP" .IP "\fB\f(CWUDPLITE4\-RECVFROM:\fP\fP" .IP "\fB\f(CWUDPLITE6\-RECVFROM:\fP\fP" .IP "\fB\f(CWUDPLITE\-RECV:\fP\fP" .IP "\fB\f(CWUDPLITE4\-RECV:\fP\fP" .IP "\fB\f(CWUDPLITE6\-RECV:\fP\fP" The UDPLITE addresses are almost identical to the related UDP addresses but they use UDP\-Lite protocol and have the additional UDPLITE option group\&. .br .IP .IP "\fB\f(CWUNIX\-CONNECT:\fP\fP" Connects to assuming it is a UNIX domain socket\&. If does not exist, this is an error; if is not a UNIX domain socket, this is an error; if is a UNIX domain socket, but no process is listening, this is an error\&. .br Option groups: FD,SOCKET,NAMED,RETRY,UNIX .br ) Useful options: bind .br See also: UNIX\-LISTEN, UNIX\-SENDTO, TCP .IP .IP "\fB\f(CWUNIX\-LISTEN:\fP\fP" Listens on using a UNIX domain stream socket and accepts a connection\&. If exists and is not a socket, this is an error\&. If exists and is a UNIX domain socket, binding to the address fails (use option unlink\-early!)\&. Note that opening this address usually blocks until a client connects\&. Beginning with socat version 1\&.4\&.3, the file system entry is removed when this address is closed (but see option unlink\-close) (example)\&. .br Option groups: FD,SOCKET,NAMED,LISTEN,CHILD,RETRY,UNIX .br Useful options: fork, umask, mode, user, group, unlink\-early .br See also: UNIX\-CONNECT, UNIX\-RECVFROM, UNIX\-RECV, TCP\-LISTEN .IP .IP "\fB\f(CWUNIX\-SENDTO:\fP\fP" Communicates with the specified peer socket, defined by [] assuming it is a UNIX domain datagram socket\&. It sends packets to and receives packets from that peer socket only\&. Please note that it might be necessary to bind the local socket to an address (e\&.g\&. \f(CW/tmp/sock1\fP, which must not exist before)\&. This address type works well with socat UNIX\-RECVFROM and UNIX\-RECV address peers\&. .br Option groups: FD,SOCKET,NAMED,UNIX .br Useful options: bind .br See also: UNIX\-RECVFROM, UNIX\-RECV, UNIX\-CONNECT, UDP\-SENDTO, IP\-SENDTO .IP .IP "\fB\f(CWUNIX\-RECVFROM:\fP\fP" Creates a UNIX domain datagram socket []\&. Receives one packet and may send one or more answer packets to that peer\&. This mode is particularly useful with fork option where each arriving packet \- from arbitrary peers \- is handled by its own sub process\&. This address works well with socat UNIX\-SENDTO address peers\&. .br Option groups: FD,SOCKET,NAMED,CHILD,UNIX .br See the note about RECVFROM addresses\&. .br Useful options: fork .br umask .br See also: UNIX\-SENDTO, UNIX\-RECV, UNIX\-LISTEN, UDP\-RECVFROM, IP\-RECVFROM .IP .IP "\fB\f(CWUNIX\-RECV:\fP\fP" Creates a UNIX domain datagram socket []\&. Receives packets from multiple unspecified peers and merges the data\&. No replies are possible, this is a read\-only address, see options \-u and \-U, and dual addresses\&. It can be, e\&.g\&., addressed by socat UNIX\-SENDTO address peers\&. It behaves similar to a syslog server\&. .br Option groups: FD,SOCKET,NAMED,UNIX .br Useful options: umask .br See also: UNIX\-SENDTO, UNIX\-RECVFROM, UNIX\-LISTEN, UDP\-RECV, IP\-RECV .IP .IP "\fB\f(CWUNIX\-CLIENT:\fP\fP" Communicates with the specified peer socket, defined by [] assuming it is a UNIX domain socket\&. It first tries to connect and, if that fails, assumes it is a datagram socket, thus supporting both types\&. .br Option groups: FD,SOCKET,NAMED,UNIX .br Useful options: bind .br See also: UNIX\-CONNECT, UNIX\-SENDTO, GOPEN .IP .IP "\fB\f(CWVSOCK\-CONNECT::\fP\fP" Establishes a VSOCK stream connection to the specified [VSOCK cid] and [VSOCK port]\&. .br Option groups: FD,SOCKET,CHILD,RETRY .br Useful options: bind, connect\-timeout, retry, readbytes .br See also: VSOCK\-LISTEN, .IP .IP "\fB\f(CWVSOCK\-LISTEN:\fP\fP" Listens on [VSOCK port] and accepts a VSOCK connection\&. Note that opening this address usually blocks until a client connects\&. .br Option groups: FD,SOCKET,LISTEN,CHILD,RETRY .br Useful options: fork, bind, max\-children, backlog, su, reuseaddr, retry .br See also: VSOCK\-CONNECT .IP .IP "\fB\f(CWABSTRACT\-CONNECT:\fP\fP" .IP "\fB\f(CWABSTRACT\-LISTEN:\fP\fP" .IP "\fB\f(CWABSTRACT\-SENDTO:\fP\fP" .IP "\fB\f(CWABSTRACT\-RECVFROM:\fP\fP" .IP "\fB\f(CWABSTRACT\-RECV:\fP\fP" .IP "\fB\f(CWABSTRACT\-CLIENT:\fP\fP" The ABSTRACT addresses are almost identical to the related UNIX addresses except that they do not address file system based sockets but an alternate UNIX domain address space\&. To achieve this the socket address strings are prefixed with \(dq\&\e0\(dq\& internally\&. This feature is available (only?) on Linux\&. Option groups are the same as with the related UNIX addresses, except that the ABSTRACT addresses are not member of the NAMED group\&. .br Useful options: netns .PP .SH "ADDRESS OPTIONS" .PP Address options can be applied to address specifications to influence the process of opening the addresses and the properties of the resulting data channels\&. .PP For technical reasons not every option can be applied to every address type; e\&.g\&., applying a socket option to a regular file will fail\&. To catch most useless combinations as early as in the open phase, the concept of \fIoption groups\fP was introduced\&. Each option belongs to one or more option groups\&. Options can be used only with address types that support at least one of their option groups (but see option \-g)\&. .PP Address options have data types that their values must conform to\&. Every address option consists of just a keyword or a keyword followed by \(dq\&=value\(dq\&, where value must conform to the options type\&. Some address options manipulate parameters of system calls; e\&.g\&., option sync sets the \f(CWO_SYNC\fP flag with the \f(CWopen()\fP call\&. Other options cause a system or library call; e\&.g\&., with option `ttl=value\(cq\& the \f(CWsetsockopt(fd, SOL_IP, IP_TTL, value, sizeof(int))\fP call is applied\&. Other options set internal \fBsocat\fP variables that are used during data transfer; e\&.g\&., `crnl\(cq\& causes 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 \f(CWchroot()\fP call\&. .PP If multiple options are given to an address, their sequence in the address specification has (almost) no effect on the sequence of their execution/application\&. Instead, \fBsocat\fP has built in an \fIoption phase\fP model that tries to bring the options in a useful order\&. Some options exist in different forms (e\&.g\&., unlink, unlink\-early, unlink\-late) to control the time of their execution\&. .PP If the same option is specified more than once within one address specification, with equal or different values, the effect depends on the kind of option\&. Options resulting in function calls like \f(CWsetsockopt()\fP cause multiple invocations\&. With options that set parameters for a required call like \f(CWopen()\fP or set internal flags, the value of the last option occurrence is effective\&. .PP The existence or semantics of many options are system dependent\&. \fBSocat\fP usually does NOT try to emulate missing libc or kernel features, it just provides an interface to the underlying system\&. So, if an operating system lacks a feature, the related option is simply not available on this platform\&. .PP The following paragraphs introduce just the more common address options\&. For a more comprehensive reference and to find information about canonical option names, alias names, option phases, and platforms see file \fBxio\&.help\fP\&. .br .br .PP .br .PP \fI\fBFD option group\fP\fP .PP This option group contains options that are applied to a UN*X style file descriptor, no matter how it was generated\&. Because all current \fBsocat\fP address types are file descriptor based, these options may be applied to any address\&. .br Note: Some of these options are also member of another option group, that provides another, non\-fd based mechanism\&. For these options, it depends on the actual address type and its option groups which mechanism is used\&. The second, non\-fd based mechanism is prioritized\&. .IP "\fB\f(CWcloexec[=]\fP\fP" Sets the \f(CWFD_CLOEXEC\fP flag with the \f(CWfcntl()\fP system call to value \&. If set, the file descriptor is closed on \f(CWexec()\fP family function calls\&. \fBSocat\fP internally handles this flag for the fds it controls, so in most cases there will be no need to apply this option\&. .IP "\fB\f(CWsetlk[=]\fP\fP" Tries to set a discretionary write lock to the whole file using the \f(CWfcntl(fd, F_SETLK, \&.\&.\&.)\fP system call\&. If the file is already locked, this call results in an error\&. On Linux, when the file permissions for group are \(dq\&S\(dq\& (g\-x,g+s), and the file system is locally mounted with the \(dq\&mand\(dq\& option, the lock is mandatory, i\&.e\&. prevents other processes from opening the file\&. .IP "\fB\f(CWsetlkw[=]\fP\fP" Tries to set a discretionary waiting write lock to the whole file using the \f(CWfcntl(fd, F_SETLKW, \&.\&.\&.)\fP system call\&. If the file is already locked, this call blocks\&. See option setlk for information about making this lock mandatory\&. .IP "\fB\f(CWsetlk\-rd[=]\fP\fP" Tries to set a discretionary read lock to the whole file using the \f(CWfcntl(fd, F_SETLK, \&.\&.\&.)\fP system call\&. If the file is already write locked, this call results in an error\&. See option setlk for information about making this lock mandatory\&. .IP "\fB\f(CWsetlkw\-rd[=]\fP\fP" Tries to set a discretionary waiting read lock to the whole file using the \f(CWfcntl(fd, F_SETLKW, \&.\&.\&.)\fP system call\&. If the file is already write locked, this call blocks\&. See option setlk for information about making this lock mandatory\&. .IP "\fB\f(CWflock\-ex[=]\fP\fP" Tries to set a blocking exclusive advisory lock to the file using the \f(CWflock(fd, LOCK_EX)\fP system call\&. \fBSocat\fP hangs in this call if the file is locked by another process\&. .IP "\fB\f(CWflock\-ex\-nb[=]\fP\fP" Tries to set a nonblocking exclusive advisory lock to the file using the \f(CWflock(fd, LOCK_EX|LOCK_NB)\fP system call\&. If the file is already locked, this option results in an error\&. .IP "\fB\f(CWflock\-sh[=]\fP\fP" Tries to set a blocking shared advisory lock to the file using the \f(CWflock(fd, LOCK_SH)\fP system call\&. \fBSocat\fP hangs in this call if the file is locked by another process\&. .IP "\fB\f(CWflock\-sh\-nb[=]\fP\fP" Tries to set a nonblocking shared advisory lock to the file using the \f(CWflock(fd, LOCK_SH|LOCK_NB)\fP system call\&. If the file is already locked, this option results in an error\&. .IP "\fB\f(CWlock[=]\fP\fP" Sets a blocking lock on the file\&. Uses the setlk or flock mechanism depending on availability on the particular platform\&. If both are available, the POSIX variant (setlkw) is used\&. .IP "\fB\f(CWuser=\fP\fP" Sets the (owner) of the stream\&. If the address is member of the NAMED option group, \fBsocat\fP uses the \f(CWchown()\fP system call after opening the file or binding to the UNIX domain socket (race condition!)\&. Without filesystem entry, \fBsocat\fP sets the user of the stream using the \f(CWfchown()\fP system call\&. These calls might require root privilege\&. .IP "\fB\f(CWuser\-late=\fP\fP" Sets the owner of the fd to with the \f(CWfchown()\fP system call after opening or connecting the channel\&. This is useful only on file system entries\&. .IP "\fB\f(CWgroup=\fP\fP" Sets the of the stream\&. If the address is member of the NAMED option group, \fBsocat\fP uses the \f(CWchown()\fP system call after opening the file or binding to the UNIX domain socket (race condition!)\&. Without filesystem entry, \fBsocat\fP sets the group of the stream with the \f(CWfchown()\fP system call\&. These calls might require group membership or root privilege\&. .IP "\fB\f(CWgroup\-late=\fP\fP" Sets the group of the fd to with the \f(CWfchown()\fP system call after opening or connecting the channel\&. This is useful only on file system entries\&. .IP "\fB\f(CWmode=\fP\fP" Sets the [mode_t] (permissions) of the stream\&. If the address is member of the NAMED option group and uses the \f(CWopen()\fP or \f(CWcreat()\fP call, the mode is applied with these\&. If the address is member of the NAMED option group without using these system calls, \fBsocat\fP uses the \f(CWchmod()\fP system call after opening the filesystem entry or binding to the UNIX domain socket (race condition!)\&. Otherwise, \fBsocat\fP sets the mode of the stream using \f(CWfchmod()\fP \&. These calls might require ownership or root privilege\&. .IP "\fB\f(CWperm\-late=\fP\fP" Sets the permissions of the fd to value [mode_t] using the \f(CWfchmod()\fP system call after opening or connecting the channel\&. This is useful only on file system entries\&. .IP "\fB\f(CWappend[=]\fP\fP" Always writes data to the actual end of file\&. If the address is member of the OPEN option group, \fBsocat\fP uses the \f(CWO_APPEND\fP flag with the \f(CWopen()\fP system call (example)\&. Otherwise, \fBsocat\fP applies the \f(CWfcntl(fd, F_SETFL, O_APPEND)\fP call\&. .IP "\fB\f(CWnonblock[=]\fP\fP" Tries to open or use file in nonblocking mode\&. Its only effects are that the \f(CWconnect()\fP call of TCP addresses does not block, and that opening a named pipe for reading does not block\&. If the address is member of the OPEN option group, \fBsocat\fP uses the \f(CWO_NONBLOCK\fP flag with the \f(CWopen()\fP system call\&. Otherwise, \fBsocat\fP applies the \f(CWfcntl(fd, F_SETFL, O_NONBLOCK)\fP call\&. .IP "\fB\f(CWbinary[=]\fP\fP" Opens the file in binary mode to avoid implicit line terminator conversions (Cygwin)\&. .IP "\fB\f(CWtext[=]\fP\fP" Opens the file in text mode to force implicit line terminator conversions (Cygwin)\&. .IP "\fB\f(CWnoinherit[=]\fP\fP" Does not keep this file open in a spawned process (Cygwin)\&. .IP "\fB\f(CWcool\-write[=]\fP\fP" Takes it easy when write fails with EPIPE or ECONNRESET and logs the message with \fInotice\fP level instead of \fIerror\fP\&. This prevents the log file from being filled with useless error messages when \fBsocat\fP is used as a high volume server or proxy where clients often abort the connection\&. Use this option only with option fork because otherwise it might cause \fBsocat\fP to exit with code 0 even on failure\&. .br This option is deprecated, consider using option children\-shutup instead\&. .IP "\fB\f(CWend\-close[=]\fP\fP" Changes the (address dependent) method of ending a connection to just close the file descriptors\&. This is useful when the connection is to be reused by or shared with other processes (example)\&. .br Normally, socket connections will be ended with \f(CWshutdown(2)\fP which terminates the socket even if it is shared by multiple processes\&. \f(CWclose(2)\fP \(dq\&unlinks\(dq\& the socket from the process but keeps it active as long as there are still links from other processes\&. .br Similarly, when an address of type EXEC or SYSTEM is ended, socat usually will explicitly kill the sub process\&. With this option, it will just close the file descriptors\&. .IP "\fB\f(CWshut\-none[=]\fP\fP" Changes the (address dependent) method of shutting down the write part of a connection to not do anything\&. .IP "\fB\f(CWshut\-down[=]\fP\fP" Changes the (address dependent) method of shutting down the write part of a connection to shutdown(fd, SHUT_WR)\&. Is only useful with sockets\&. .IP "\fB\f(CWshut\-close[=]\fP\fP" Changes the (address dependent) method of shutting down the write part of a connection to close(fd)\&. .IP "\fB\f(CWshut\-null[=]\fP\fP" When one address indicates EOF, \fBsocat\fP will send a zero sized packet to the write channel of the other address to transfer the EOF condition\&. This is useful with UDP and other datagram protocols\&. Has been tested against netcat and socat with option null\-eof\&. .IP "\fB\f(CWnull\-eof[=]\fP\fP" Normally \fBsocat\fP will ignore empty (zero size payload) packets arriving on datagram sockets, so it survives port scans\&. With this option \fBsocat\fP interprets empty datagram packets as EOF indicator (see shut\-null)\&. .IP "\fB\f(CWioctl\-void=\fP\fP" Calls \f(CWioctl()\fP with the request value as second argument and NULL as third argument\&. This option allows utilizing ioctls that are not explicitly implemented in socat\&. .IP "\fB\f(CWioctl\-int=:\fP\fP" Calls \f(CWioctl()\fP with the request value as second argument and the integer value as third argument\&. .IP "\fB\f(CWioctl\-intp=:\fP\fP" Calls \f(CWioctl()\fP with the request value as second argument and a pointer to the integer value as third argument\&. .IP "\fB\f(CWioctl\-bin=:\fP\fP" Calls \f(CWioctl()\fP with the request value as second argument and a pointer to the given data value as third argument\&. This data must be specified in form\&. .IP "\fB\f(CWioctl\-string=:\fP\fP" Calls \f(CWioctl()\fP with the request value as second argument and a pointer to the given string as third argument\&. form\&. .PP .br .PP \fI\fBNAMED option group\fP\fP .PP These options work on file system entries\&. .br Please note that, with UNIX domain client addresses, this means the bind entry, not the target/peer entry\&. .br See also options user, group, and mode\&. .PP .IP "\fB\f(CWuser\-early=\fP\fP" Changes the (owner) of the file system entry before accessing it, using the \f(CWchown()\fP system call\&. This call might require root privilege\&. .IP "\fB\f(CWgroup\-early=\fP\fP" Changes the of the file system entry before accessing it, using the \f(CWchown()\fP system call\&. This call might require group membership or root privilege\&. .IP "\fB\f(CWperm\-early=\fP\fP" Changes the [mode_t] of the file system entry before accessing it, using the \f(CWchmod()\fP system call\&. This call might require ownership or root privilege\&. .IP "\fB\f(CWunlink\-early[=]\fP\fP" Unlinks (removes) the file before opening it and even before applying user\-early etc\&. .IP "\fB\f(CWunlink[=]\fP\fP" Unlinks (removes) the file before accessing it, but after user\-early etc\&. .IP "\fB\f(CWunlink\-late[=]\fP\fP" Unlinks (removes) the file after opening it to make it inaccessible for other processes after a short race condition\&. .IP "\fB\f(CWunlink\-close[=]\fP\fP" Controls removal of the addresses file system entry when closing the address\&. For named pipes, UNIX domain sockets, and the symbolic links of pty addresses, the default is remove (1); for created files, opened files, and generic opened files the default is keep (0)\&. Setting this option to 1 removes the entry, 0 keeps it\&. No value means 1\&. .PP .br .PP \fI\fBOPEN option group\fP\fP .PP The OPEN group options allow setting flags with the \f(CWopen()\fP system call\&. E\&.g\&., option `creat\(cq\& sets the \f(CWO_CREAT\fP flag\&. When the used address does not use \f(CWopen()\fP (e\&.g\&.STDIO), the \f(CWfcntl(\&.\&.\&., F_SETFL, \&.\&.\&.)\fP call is used instead\&. .br See also options append and nonblock\&. .IP "\fB\f(CWcreat[=]\fP\fP" Creates the file if it does not exist (example)\&. .IP "\fB\f(CWdsync[=]\fP\fP" Blocks \f(CWwrite()\fP calls until metainfo is physically written to media\&. .IP "\fB\f(CWexcl[=]\fP\fP" With option creat, if file exists this is an error\&. .IP "\fB\f(CWlargefile[=]\fP\fP" On 32 bit systems, allows a file larger than 2^31 bytes\&. .IP "\fB\f(CWnoatime[=]\fP\fP" Sets the O_NOATIME options, so reads do not change the access timestamp\&. .IP "\fB\f(CWnoctty[=]\fP\fP" Does not make this file the controlling terminal\&. .IP "\fB\f(CWnofollow[=]\fP\fP" Does not follow symbolic links\&. .IP "\fB\f(CWnshare[=]\fP\fP" Does not allow sharing this file with other processes\&. .IP "\fB\f(CWrshare[=]\fP\fP" Does not allow other processes to open this file for writing\&. .IP "\fB\f(CWrsync[=]\fP\fP" Blocks \f(CWwrite()\fP until metainfo is physically written to media\&. .IP "\fB\f(CWsync[=]\fP\fP" Blocks \f(CWwrite()\fP until data is physically written to media\&. .IP "\fB\f(CWrdonly[=]\fP\fP" Opens the file for reading only\&. .IP "\fB\f(CWwronly[=]\fP\fP" Opens the file for writing only\&. .IP "\fB\f(CWtrunc[=]\fP\fP" Truncates the file to size 0 during opening it\&. .PP .br .PP \fI\fBREG and BLK option group\fP\fP .PP These options are usually applied to a UN*X file descriptor, but their semantics make sense only on a file supporting random access\&. .IP "\fB\f(CWseek=\fP\fP" Applies the \f(CWlseek(fd, , SEEK_SET)\fP (or \f(CWlseek64\fP ) system call, thus positioning the file pointer absolutely to [off_t or off64_t]\&. Please note that a missing value defaults to 1, not 0\&. .IP "\fB\f(CWseek\-cur=\fP\fP" Applies the \f(CWlseek(fd, , SEEK_CUR)\fP (or \f(CWlseek64\fP ) system call, thus positioning the file pointer [off_t or off64_t] bytes relatively to its current position (which is usually 0)\&. Please note that a missing value defaults to 1, not 0\&. .IP "\fB\f(CWseek\-end=\fP\fP" Applies the \f(CWlseek(fd, , SEEK_END)\fP (or \f(CWlseek64\fP ) system call, thus positioning the file pointer [off_t or off64_t] bytes relatively to the files current end\&. Please note that a missing value defaults to 1, not 0\&. .IP "\fB\f(CWftruncate=\fP\fP" Applies the \f(CWftruncate(fd, )\fP (or \f(CWftruncate64\fP if available) system call, thus truncating the file at the position [off_t or off64_t]\&. Please note that a missing value defaults to 1, not 0\&. .IP .IP "\fB\f(CWsecrm[=]\fP\fP" .IP "\fB\f(CWunrm[=]\fP\fP" .IP "\fB\f(CWcompr[=]\fP\fP" .IP "\fB\f(CWfs\-sync[=]\fP\fP" .IP "\fB\f(CWimmutable[=]\fP\fP" .IP "\fB\f(CWfs\-append[=]\fP\fP" .IP "\fB\f(CWnodump[=]\fP\fP" .IP "\fB\f(CWfs\-noatime[=]\fP\fP" .IP "\fB\f(CWjournal\-data[=]\fP\fP" .IP "\fB\f(CWnotail[=]\fP\fP" .IP "\fB\f(CWdirsync[=]\fP\fP" These options change non standard file attributes on operating systems and file systems that support these features, like Linux with ext2fs and successors, xfs, or reiserfs\&. See man 1 chattr for information on these options\&. Please note that there might be a race condition between creating the file and applying these options\&. .PP .br .PP \fI\fBPIPE options\fP\fP .PP These options may be applied to pipes (fifos)\&. .PP .IP "\fB\f(CWf\-setpipe\-sz=\fP\fP" .IP "\fB\f(CWsetpipe=\fP\fP" Set the number of bytes a pipe can buffer\&. Where more bytes are written the writing process might block\&. When more bytes are written in a single \f(CWwrite()\fP the writing process blocks and might never recover\&. .PP .br .PP \fI\fBGeneral address options\fP\fP .PP These options may be applied to all address types\&. They change some process properties that are restored after opening the address\&. .PP .IP "\fB\f(CWchdir=\fP\fP" .IP "\fB\f(CWcd=\fP\fP" Changes the working directory\&. After opening the address the master process changes back to the original working directory\&. Sub processes inherit the temporary setting\&. .IP "\fB\f(CWumask=\fP\fP" Sets the umask of the process to [mode_t] before opening the address\&. Useful when file system entries are created or a shell or program is invoked\&. Usually the value is specified as octal number\&. .br The processes \f(CWumask\fP value is inherited by child processes\&. Note: umask is an inverted value: creating a file with umask=0026 results in permissions 0640\&. .PP .br .PP \fI\fBPROCESS option group\fP\fP .PP Options of this group change the process properties instead of just affecting one data channel\&. For EXEC and SYSTEM addresses and for LISTEN and CONNECT type addresses with option fork, these options apply to the child processes instead of the main \fBsocat\fP process\&. .IP "\fB\f(CWchroot=\fP\fP" Performs a \f(CWchroot()\fP operation to after processing the address (example)\&. This call might require root privilege\&. .IP "\fB\f(CWchroot\-early=\fP\fP" Performs a \f(CWchroot()\fP operation to before opening the address\&. This call might require root privilege\&. .IP "\fB\f(CWsetgid=\fP\fP" Changes the primary of the process after processing the address\&. This call might require root privilege\&. Please note that this option does not drop other group related privileges\&. .IP "\fB\f(CWsetgid\-early=\fP\fP" Like setgit but is performed before opening the address\&. .IP "\fB\f(CWsetuid=\fP\fP" Changes the (owner) of the process after processing the address\&. This call might require root privilege\&. Please note that this option does not drop group related privileges\&. Check if option su better fits your needs\&. .IP "\fB\f(CWsetuid\-early=\fP\fP" Like setuid but is performed before opening the address\&. .IP "\fB\f(CWsu=\fP\fP" Changes the (owner) and groups of the process after processing the address (example)\&. This call might require root privilege\&. .IP "\fB\f(CWsu\-d=\fP\fP" Short name for \f(CWsubstuser\-delayed\fP\&. Changes the (owner) and groups of the process after processing the address (example)\&. The user and his groups are retrieved \fIbefore\fP a possible \f(CWchroot()\fP \&. This call might require root privilege\&. .IP "\fB\f(CWsetpgid=\fP\fP" Makes the process a member of the specified process group \&. If no value is given, or if the value is 0 or 1, the process becomes leader of a new process group\&. .IP "\fB\f(CWsetsid\fP\fP" Makes the process the leader of a new session (example)\&. .IP "\fB\f(CWnetns=\fP\fP" Before opening the address it tries to switch to the named network namespace\&. After opening the address it switches back to the previous namespace\&. (Example with TCP forwarder, example with virtual network connection\&. .br Only on Linux; requires root; use option \f(CW\-\-experimental\fP\&. .br .PP .br .PP \fI\fBREADLINE option group\fP\fP .PP These options apply to the readline address type\&. .IP "\fB\f(CWhistory=\fP\fP" Reads and writes history from/to (example)\&. .IP "\fB\f(CWnoprompt\fP\fP" Since version 1\&.4\&.0, socat per default tries to determine a prompt \- that is then passed to the readline call \- by remembering the last incomplete line of the output\&. With this option, socat does not pass a prompt to readline, so it begins line editing in the first column of the terminal\&. .IP "\fB\f(CWnoecho=\fP\fP" Specifies a regular pattern for a prompt that prevents the following input line from being displayed on the screen and from being added to the history\&. The prompt is defined as the text that was output to the readline address after the lastest newline character and before an input character was typed\&. The pattern is a regular expression, e\&.g\&. \(dq\&^[Pp]assword:\&.*$\(dq\& or \(dq\&([Uu]ser:|[Pp]assword:)\(dq\&\&. See regex(7) for details\&. (example) .IP "\fB\f(CWprompt=\fP\fP" Passes the string as prompt to the readline function\&. readline prints this prompt when stepping through the history\&. If this string matches a constant prompt issued by an interactive program on the other socat address, consistent look and feel can be achieved\&. .PP .br .PP \fI\fBAPPLICATION option group\fP\fP .PP This group contains options that work at data level\&. Note that these options only apply to the \(dq\&raw\(dq\& data transferred by socat, but not to protocol data used by addresses like PROXY\&. .IP "\fB\f(CWcr\fP\fP" Converts the default line termination character NL (\(cq\&\en\(cq\&, 0x0a) to/from CR (\(cq\&\er\(cq\&, 0x0d) when writing/reading on this channel\&. .IP "\fB\f(CWcrnl\fP\fP" Converts the default line termination character NL (\(cq\&\en\(cq\&, 0x0a) to/from CRNL (\(dq\&\er\en\(dq\&, 0x0d0a) when writing/reading on this channel (example)\&. Note: socat simply strips all CR characters\&. .IP "\fB\f(CWignoreeof\fP\fP" When EOF occurs on this channel, \fBsocat\fP ignores it and tries to read more data (like \(dq\&tail \-f\(dq\&) (example)\&. .IP "\fB\f(CWreadbytes=\fP\fP" \fBsocat\fP reads only so many bytes from this address (the address provides only so many bytes for transfer and pretends to be at EOF afterwards)\&. Must be greater than 0\&. .IP "\fB\f(CWlockfile=\fP\fP" If lockfile exists, exits with error\&. If lockfile does not exist, creates it and continues, unlinks lockfile on exit\&. .IP "\fB\f(CWwaitlock=\fP\fP" If lockfile exists, waits until it disappears\&. When lockfile does not exist, creates it and continues, unlinks lockfile on exit\&. .IP "\fB\f(CWescape=\fP\fP" Specifies the numeric code of a character that triggers EOF on the input stream\&. It is useful with a terminal in raw mode (example)\&. .PP .br .PP \fI\fBSOCKET option group\fP\fP .PP These options are intended for all kinds of sockets, e\&.g\&. IP or UNIX domain\&. Most are applied with a \f(CWsetsockopt()\fP call\&. .IP "\fB\f(CWbind=\fP\fP" Binds the socket to the given socket address using the \f(CWbind()\fP system call\&. The form of is socket domain dependent: IP4 and IP6 allow the form [hostname|hostaddress][:(service|port)] (example), VSOCK allows the form [cid][:(port)]\&. .br See also: unix\-bind\-tempname .IP "\fB\f(CWconnect\-timeout=\fP\fP" Abort the connection attempt after [timeval] with error status\&. .IP "\fB\f(CWso\-bindtodevice=\fP\fP" Binds the socket to the given \&. This option might require root privilege\&. .IP "\fB\f(CWbroadcast\fP\fP" For datagram sockets, allows sending to broadcast addresses and receiving packets addressed to broadcast addresses\&. .IP "\fB\f(CWdebug\fP\fP" Enables socket debugging\&. .IP "\fB\f(CWdontroute\fP\fP" Only communicates with directly connected peers, does not use routers\&. .IP "\fB\f(CWkeepalive\fP\fP" Enables sending keepalives on the socket\&. .IP "\fB\f(CWlinger=\fP\fP" Blocks \f(CWshutdown()\fP or \f(CWclose()\fP until data transfers have finished or the given timeout [int] expired\&. .IP "\fB\f(CWoobinline\fP\fP" Places out\-of\-band data in the input data stream\&. .IP "\fB\f(CWpriority=\fP\fP" Sets the protocol defined [] for outgoing packets\&. .IP "\fB\f(CWrcvbuf=\fP\fP" Sets the size of the receive buffer after the \f(CWsocket()\fP call to [int]\&. With TCP sockets, this value corresponds to the socket\(cq\&s maximal window size\&. .IP "\fB\f(CWrcvbuf\-late=\fP\fP" Sets the size of the receive buffer when the socket is already connected to [int]\&. With TCP sockets, this value corresponds to the socket\(cq\&s maximal window size\&. .IP "\fB\f(CWso\-rcvtimeo=