---
obj: application
repo: https://repo.or.cz/socat.git
website: http://www.dest-unreach.org/socat
rev: 2024-09-01
---

# socat
socat (SOcket CAT) is a powerful command-line utility designed for data transfer and networking. It functions similarly to the popular [netcat](netcat.md) (nc) tool but offers additional features and flexibility, making it suitable for a wide range of network and system administration tasks. Socat enables bidirectional data transfer between two independent data channels, which can be files, pipes, devices (e.g., serial lines), or network sockets.

## Usage
Usage: `socat [options] <address> <address>`

### Options

| Option      | Description                                                                                                                             |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| `-r <file>` | Dumps the raw (binary) data flowing from left to right address to the given file.                                                       |
| `-R <file>` | Dumps the raw (binary) data flowing from right to left address to the given file.                                                       |
| `-b<size>`  | Sets the data transfer block `<size>`. At most `<size>` bytes are transferred per step. Default is `8192` bytes.                        |
| `-u`        | Uses unidirectional mode. The first address is only used for reading, and the second address is only used for writing (example).        |
| `-U`        | Uses unidirectional mode in reverse direction. The first address is only used for writing, and the second address is only used for read |

### Address
With the address command line arguments, the user gives socat instructions and the necessary information for establishing the byte streams.
An address specification usually consists of an address type keyword, zero or more required address parameters separated by `:` from the keyword and from each other, and zero or more address options separated by `,`.

The keyword specifies the address type (e.g., `TCP4`, `OPEN`, `EXEC`). For some keywords there exist synonyms (`-` 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 `/` is found before the first `:` or `,`, `GOPEN` (generic file open) is assumed.

#### Address Types
This section describes the available address types with their keywords, parameters, and semantics.

`CREATE:<filename>`
Opens `<filename>` and uses the file descriptor for writing. This address type requires write-only context.
Option groups: `FD`,`REG`,`NAMED`
Useful options: `mode`, `user`, `group`, `unlink-early`, `unlink-late`, `append`

`EXEC:<command-line>`
Forks a sub process that establishes communication with its parent process and invokes the specified program with `execvp()` . `<command-line>` is a simple command with arguments separated by single spaces. If the program name contains a `/`, the part after the last `/` is taken as `ARGV[0]`.
Option groups: `FD`,`SOCKET`,`EXEC`,`FORK
Useful options: `path`, `fdin`, `fdout`, `chroot`, `su`, `su-d`, `nofork`, `pty`, `stderr`, `ctty`, `setsid`, `pipes`, `login`, `sigint`, `sigquit`

`FD:<fdnum>`
Uses the file descriptor `<fdnum>`. It must already exist as valid UNIX file descriptor.
Option groups: `FD`
See also: `STDIO`, `STDIN`, `STDOUT`, `STDERR`

`GOPEN:<filename>`
(Generic open) This address type tries to handle any file system entry except directories usefully. `<filename>` may be a relative or absolute path.
Option groups: `FD`,`REG`,`SOCKET`,`NAMED`,`OPEN`
See also: `OPEN`, `CREATE`, `UNIX-CONNECT`

`IP-SENDTO:<host>:<protocol>`
Opens a raw IP socket. Depending on host specification or option pf, IP protocol version 4 or 6 is used. It uses `<protocol>` to send packets to `<host>` [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.
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`
Useful options: `pf`, `ttl`
See also: `IP4-SENDTO`, `IP6-SENDTO`, `IP-RECVFROM`, `IP-RECV`, `UDP-SENDTO`, `UNIX-SENDTO`

`IP4-SENDTO:<host>:<protocol>`
Like `IP-SENDTO`, but always uses IPv4.
Option groups: `FD`,`SOCKET`,`IP4`

`IP6-SENDTO:<host>:<protocol>`
Like `IP-SENDTO`, but always uses IPv6.
Option groups: `FD`,`SOCKET`,`IP6`

`INTERFACE:<interface>`
Communicates with a network connected on an interface using raw packets including link level data. `<interface>` is the name of the network interface. Currently only available on Linux.
Option groups: `FD`,`SOCKET`
Useful options: `pf`, `type`

`IP-DATAGRAM:<address>:<protocol>`
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.
Option groups: `FD`, `SOCKET`, `IP4`, `IP6`, `RANGE`
Useful options: `bind`, `range`, `tcpwrap`, `broadcast`, `ip-multicast-loop`, `ip-multicast-ttl`, `ip-multicast-if`, `ip-add-membership`, `ip-add-source-membership`,
`ttl`, `tos`, `pf`
See also: `IP4-DATAGRAM`, `IP6-DATAGRAM`, `IP-SENDTO`, `IP-RECVFROM`, `IP-RECV`, `UDP-DATAGRAM`

`IP4-DATAGRAM:<host>:<protocol>`
Like `IP-DATAGRAM`, but always uses IPv4. (example)
Option groups: `FD`,`SOCKET`,`IP4`,`RANGE`

`IP6-DATAGRAM:<host>:<protocol>`
Like `IP-DATAGRAM`, but always uses IPv6. Please note that IPv6 does not know broadcasts.
Option groups: `FD`,`SOCKET`,`IP6`,`RANGE`

`IP-RECVFROM:<protocol>`
Opens a raw IP socket of `<protocol>`. 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. 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. This address works well with `IP-SENDTO` address peers. Protocol 255 uses the raw socket with the IP header being part of the data.
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`,`CHILD`,`RANGE`
Useful options: `pf`, `fork`, `range`, `ttl`, `broadcast`
See also: `IP4-RECVFROM`, `IP6-RECVFROM`, `IP-SENDTO`, `IP-RECV`, `UDP-RECVFROM`, `UNIX-RECVFROM`

`IP4-RECVFROM:<protocol>`
Like `IP-RECVFROM`, but always uses IPv4.
Option groups: `FD`,`SOCKET`,`IP4`,`CHILD`,`RANGE`

`IP6-RECVFROM:<protocol>`
Like `IP-RECVFROM`, but always uses IPv6.
Option groups: `FD`,`SOCKET`,`IP6`,`CHILD`,`RANGE`

`IP-RECV:<protocol>`
Opens a raw IP socket of `<protocol>`. 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. 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.
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`,`RANGE`
Useful options: `pf`, `range`
See also: `IP4-RECV`, `IP6-RECV`, `IP-SENDTO`, `IP-RECVFROM`, `UDP-RECV`, `UNIX-RECV`

`IP4-RECV:<protocol>`
Like `IP-RECV`, but always uses IPv4.
Option groups: `FD`,`SOCKET`,`IP4`,`RANGE`

`IP6-RECV:<protocol>`
Like `IP-RECV`, but always uses IPv6.
Option groups: `FD`,`SOCKET`,`IP6`,`RANGE`

`OPEN:<filename>`
Opens `<filename>` using the `open()` system call. This operation fails on UNIX domain sockets. Note: This address type is rarely useful in bidirectional mode.
Option groups: `FD`,`REG`,`NAMED`,`OPEN`
Useful options: `creat`, `excl`, `noatime`, `nofollow`, `append`, `rdonly`, `wronly`, `lock`, `readbytes`, `ignoreeof`
See also: `CREATE`, `GOPEN`, `UNIX-CONNECT`

`OPENSSL:<host>:<port>`
Tries to establish a SSL connection to `<port>` [TCP service] on `<host>` [IP address] using TCP/IP version 4 or 6 depending on address specification, name resolution, or option pf.
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`,`TCP`,`OPENSSL`,`RETRY`
Useful options: `cipher`, `verify`, `commonname`, `cafile`, `capath`, `certificate`, `key`, `compress`, `bind`, `pf`, `connect-timeout`, `sourceport`, `retry`
See also: `OPENSSL-LISTEN`, `TCP`

`OPENSSL-LISTEN:<port>`
Listens on tcp `<port>` [TCP service]. The IP version is 4 or the one specified with pf. When a connection is accepted, this address behaves as SSL server.
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`,`TCP`,`LISTEN`,`OPENSSL`,`CHILD`,`RANGE`,`RETRY`
Useful options: `pf`, `cipher`, `verify`, `commonname`, `cafile`, `capath`, `certificate`, `key`, `compress`, `fork`, `bind`, `range`, `tcpwrap`, `su`, `reuseaddr`, `retry`
See also: `OPENSSL`, `TCP-LISTEN`

`OPENSSL-DTLS-CLIENT:<host>:<port>`
Tries to establish a DTLS connection to `<port>` [UDP service] on `<host>` [IP address] using UDP/IP version 4 or 6 depending on address specification, name resolution, or option pf. Socat checks the peer certificates subjectAltName or commonName against the addresses option openssl-commonname or the host name. Wildcards in the certificate are supported.
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`,`OPENSSL`,`RETRY`
Useful options: `cipher`, `verify`, `commonname`, `cafile`, `capath`, `certificate`, `key`, `compress`, `bind`, `pf`, `sourceport`, `retry`
See also: `OPENSSL-DTLS-SERVER`, `OPENSSL-CONNECT`, `UDP-CONNECT`

`OPENSSL-DTLS-SERVER:<port>`
Listens on UDP `<port>` [UDP service]. The IP version is 4 or the one specified with pf. When a connection is accepted, this address behaves as DTLS server.
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`,`LISTEN`,`OPENSSL`,`CHILD`,`RANGE`,`RETRY`
Useful options: `pf`, `cipher`, `verify`, `commonname`, `cafile`, `capath`, `certificate`, `key`, `compress`, `fork`, `bind`, `range`, `tcpwrap`, `su`, `reuseaddr`, `retry`
See also: `OPENSSL-DTLS-CLIENT`, `OPENSSL-LISTEN`, `UDP-LISTEN`

`PIPE:<filename>`
If `<filename>` already exists, it is opened. If it does not exist, a named pipe is created and opened.
Option groups: `FD`,`NAMED`,`OPEN`
Useful options: `rdonly`, `nonblock`, `group`, `user`, `mode`, `unlink-early`

`PIPE` 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.

`PROXY:<proxy>:<hostname>:<port>`
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. Note that the traffic need not be HTTP but can be an arbitrary protocol.
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`,`TCP`,`HTTP`,`RETRY`
Useful options: `proxyport`, `ignorecr`, `proxyauth`, `resolve`, `crnl`, `bind`, `connect-timeout`, `mss`, `sourceport`, `retry`

`PTY` Generates a pseudo terminal (pty) and uses its master side. Another process may open the pty`s slave side using it like a serial line or terminal. If both the ptmx and the openpty mechanisms are available, ptmx is used (POSIX).
Option groups: `FD`,`NAMED`,`PTY`
Useful options: `link`, `openpty`, `wait-slave`, `mode`, `user`, `group`
See also: `UNIX-LISTEN`, `PIPE`, `EXEC`, `SYSTEM`

`SOCKET-CONNECT:<domain>:<protocol>:<remote-address>`
Creates a stream socket using the first and second given socket parameters and `SOCK_STREAM` 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.
Option groups: `FD`,`SOCKET`,`CHILD`,`RETRY`
Useful options: `bind`, `setsockopt`,
See also: `TCP`, `UDP-CONNECT`, `UNIX-CONNECT`, `SOCKET-LISTEN`, `SOCKET-SENDTO`

`SOCKET-DATAGRAM:<domain>:<type>:<protocol>:<remote-address>`
Creates a datagram socket using the first three given socket parameters and sends outgoing data to the remote-address. The three socket parameters have to be specified by int numbers.
Option groups: `FD`,`SOCKET`,`RANGE`
Useful options: `bind`, `range`, `setsockopt`
See also: `UDP-DATAGRAM`, `IP-DATAGRAM`, `SOCKET-SENDTO`, `SOCKET-RECV`, `SOCKET-RECVFROM`

`SOCKET-LISTEN:<domain>:<protocol>:<local-address>`
Creates a stream socket using the first and second given socket parameters and SOCK_STREAM and waits for incoming connections
on local-address. The two socket parameters have to be specified by int numbers.
Option groups: `FD`,`SOCKET`,`LISTEN`,`RANGE`,`CHILD`,`RETRY`
Useful options: `setsockopt`, `setsockopt-listen`
See also: `TCP`, `UDP-CONNECT`, `UNIX-CONNECT`, `SOCKET-LISTEN`, `SOCKET-SENDTO`, `SOCKET-SENDTO`

`SOCKET-RECV:<domain>:<type>:<protocol>:<local-address>`
Creates a socket using the three given socket parameters and binds it to `<local-address>`. Receives arriving data. The three parameters have to be specified by int numbers.
Option groups: `FD`,`SOCKET`,`RANGE`
Useful options: `range`, `setsockopt`, `setsockopt-listen`
See also: `UDP-RECV`, `IP-RECV`, `UNIX-RECV`, `SOCKET-DATAGRAM`, `SOCKET-SENDTO`, `SOCKET-RECVFROM`

`SOCKET-RECVFROM:<domain>:<type>:<protocol>:<local-address>`
Creates a socket using the three given socket parameters and binds it to `<local-address>`. Receives arriving data and sends replies back to the sender. The first three parameters have to be specified as int numbers.
Option groups: `FD`,`SOCKET`,`CHILD`,`RANGE`
Useful options: `fork`, `range`, `setsockopt`, `setsockopt-listen`
See also: `UDP-RECVFROM`, `IP-RECVFROM`, `UNIX-RECVFROM`, `SOCKET-DATAGRAM`, `SOCKET-SENDTO`, `SOCKET-RECV`

`SOCKET-SENDTO:<domain>:<type>:<protocol>:<remote-address>`
Creates a socket using the three given socket parameters. Sends outgoing data to the given address and receives replies. The
three parameters have to be specified as int numbers.
Option groups: `FD`,`SOCKET`
Useful options: `bind`, `setsockopt`, `setsockopt-listen`
See also: `UDP-SENDTO`, `IP-SENDTO`, `UNIX-SENDTO`, `SOCKET-DATAGRAM`, `SOCKET-RECV`, `SOCKET-RECVFROM`

`SOCKS4:<socks-server>:<host>:<port>`
Connects via `<socks-server>` [IP address] to `<host>` [IPv4 address] on `<port>` [TCP service], using socks version 4 protocol over IP version 4 or 6 depending on address specification, name resolution, or option pf (example).
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`,`TCP`,`SOCKS4`,`RETRY`
Useful options: `socksuser`, `socksport`, `sourceport`, `pf`, `retry`
See also: `SOCKS4A`, `PROXY`, `TCP`

`SOCKS4A:<socks-server>:<host>:<port>`
like `SOCKS4`, but uses socks protocol version 4a, thus leaving host name resolution to the socks server.
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`,`TCP`,`SOCKS4`,`RETRY`

`STDERR` Uses file descriptor 2.
Option groups: `FD`

`STDIN` Uses file descriptor 0.
Option groups: `FD`

`STDIO` Uses file descriptor 0 for reading, and 1 for writing.
Option groups: `FD`

`STDOUT` Uses file descriptor 1.
Option groups: `FD`

`SYSTEM:<shell-command>`
Forks a sub process that establishes communication with its parent process and invokes the specified program with `system()` . Please note that `<shell-command>` must not contain `,` or "!!", and that shell meta characters may have to be protected. After successful program start, socat writes data to stdin of the process and reads from its stdout.
Option groups: `FD`,`SOCKET`,`EXEC`,`FORK`
Useful options: `path`, `fdin`, `fdout`, `chroot`, `su`, `su-d`, `nofork`, `pty`, `stderr`, `ctty`, `setsid`, `pipes`, `sigint`, `sigquit`
See also: `EXEC`

`TCP:<host>:<port>`
Connects to `<port>` [TCP service] on `<host>` [IP address] using TCP/IP version 4 or 6 depending on address specification, name resolution, or option pf.
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`,`TCP`,`RETRY`
Useful options: `crnl`, `bind`, `pf`, `connect-timeout`, `tos`, `mtudiscover`, `mss`, `nodelay`, `nonblock`, `sourceport`, `retry`, `readbytes`
See also: `TCP4`, `TCP6`, `TCP-LISTEN`, `UDP`, `SCTP-CONNECT`, `UNIX-CONNECT`

`TCP4:<host>:<port>`
Like `TCP`, but only supports IPv4 protocol.
Option groups: `FD`,`SOCKET`,`IP4`,`TCP`,`RETRY`

`TCP6:<host>:<port>`
Like `TCP`, but only supports IPv6 protocol.
Option groups: `FD`,`SOCKET`,`IP6`,`TCP`,`RETRY`

`TCP-LISTEN:<port>`
Listens on `<port>` [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.
Option groups: `FD`,`SOCKET`,`LISTEN`,`CHILD`,`RANGE`,`IP4`,`IP6`,`TCP`,`RETRY`
Useful options: `crnl`, `fork`, `bind`, `range`, `tcpwrap`, `pf`, `max-children`, `backlog`, `accept-timeout`, `mss`, `su`, `reuseaddr`, `retry`, `cool-write`
See also: `TCP4-LISTEN`, `TCP6-LISTEN`, `UDP-LISTEN`, `UNIX-LISTEN`, `OPENSSL-LISTEN`, `TCP-CONNECT`

`TCP4-LISTEN:<port>`
Like `TCP-LISTEN`, but only supports IPv4 protocol.
Option groups: `FD`,`SOCKET`,`LISTEN`,`CHILD`,`RANGE`,`IP4`,`TCP`,`RETRY`

`TCP6-LISTEN:<port>`
Like `TCP-LISTEN`, but only supports IPv6 protocol.
Option groups: `FD`,`SOCKET`,`LISTEN`,`CHILD`,`RANGE`,`IP6`,`TCP`,`RETRY`

`TUN[:<if-addr>/<bits>]`
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 "wire side". This address requires read and write access to the tunnel cloning device, usually `/dev/net/tun`, as well as permission to set some ioctl()s. Option iff-up is required to immediately activate the interface!
Option groups: `FD`,`NAMED`,`OPEN`,`TUN`
Useful options: `iff-up`, `tun-device`, `tun-name`, `tun-type`, `iff-no-pi`

`UDP:<host>:<port>`
Connects to `<port>` [UDP service] on `<host>` [IP address] using UDP/IP version 4 or 6 depending on address specification, name resolution, or option pf.
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`
Useful options: `ttl`, `tos`, `bind`, `sourceport`, `pf`
See also: `UDP4`, `UDP6`, `UDP-LISTEN`, `TCP`, `IP`

`UDP4:<host>:<port>`
Like `UDP`, but only supports IPv4 protocol.
Option groups: `FD`,`SOCKET`,`IP4`

`UDP6:<host>:<port>`
Like `UDP`, but only supports IPv6 protocol.
Option groups: `FD`,`SOCKET`,`IP6`

`UDP-DATAGRAM:<address>:<port>`
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 Socat 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.
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`,`RANGE`
Useful options: `bind`, `range`, `tcpwrap`, `broadcast`, `ip-multicast-loop`, `ip-multicast-ttl`, `ip-multicast-if`, `ip-add-membership`, `ip-add-source-membership`, `ttl`, `tos`, `sourceport`, `pf`
See also: `UDP4-DATAGRAM`, `UDP6-DATAGRAM`, `UDP-SENDTO`, `UDP-RECVFROM`, `UDP-RECV`, `UDP-CONNECT`, `UDP-LISTEN`, `IP-DATAGRAM`

`UDP4-DATAGRAM:<address>:<port>`
Like `UDP-DATAGRAM`, but only supports IPv4 protocol.
Option groups: `FD`,`SOCKET`,`IP4`, `RANGE`

`UDP6-DATAGRAM:<address>:<port>`
Like `UDP-DATAGRAM`, but only supports IPv6 protocol.
Option groups: `FD`,`SOCKET`,`IP6`,`RANGE`

`UDP-LISTEN:<port>`
Waits for a UDP/IP packet arriving on `<port>` [UDP service] and `connects` 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.
Option groups: `FD`,`SOCKET`,`LISTEN`,`CHILD`,`RANGE`,`IP4`,`IP6`
Useful options: `fork`, `bind`, `range`, `pf`
See also: `UDP`, `UDP4-LISTEN`, `UDP6-LISTEN`, `TCP-LISTEN`

`UDP4-LISTEN:<port>`
Like `UDP-LISTEN`, but only support IPv4 protocol.
Option groups: `FD`,`SOCKET`,`LISTEN`,`CHILD`,`RANGE`,`IP4`

`UDP6-LISTEN:<port>`
Like `UDP-LISTEN`, but only support IPv6 protocol.
Option groups: `FD`,`SOCKET`,`LISTEN`,`CHILD`,`RANGE`,`IP6`

`UDP-SENDTO:<host>:<port>`
Communicates with the specified peer socket, defined by `<port>` [UDP service] on `<host>` [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.
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`
Useful options: `ttl`, `tos`, `bind`, `sourceport`, `pf`
See also: `UDP4-SENDTO`, `UDP6-SENDTO`, `UDP-RECVFROM`, `UDP-RECV`, `UDP-CONNECT`, `UDP-LISTEN`, `IP-SENDTO`

`UDP4-SENDTO:<host>:<port>`
Like `UDP-SENDTO`, but only supports IPv4 protocol.
Option groups: `FD`,`SOCKET`,`IP4`

`UDP6-SENDTO:<host>:<port>`
Like `UDP-SENDTO`, but only supports IPv6 protocol.
Option groups: `FD`,`SOCKET`,`IP6`

`UDP-RECVFROM:<port>`
Creates a UDP socket on `<port>` [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.
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.
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`,`CHILD`,`RANGE`
Useful options: `fork`, `ttl`, `tos`, `bind`, `sourceport`, `pf`
See also: `UDP4-RECVFROM`, `UDP6-RECVFROM`, `UDP-SENDTO`, `UDP-RECV`, `UDP-CONNECT`, `UDP-LISTEN`, `IP-RECVFROM`, `UNIX-RECVFROM`

`UDP4-RECVFROM:<port>`
Like `UDP-RECVFROM`, but only supports IPv4 protocol.
Option groups: `FD`,`SOCKET`,`IP4`,`CHILD`,`RANGE`

`UDP6-RECVFROM:<port>`
Like `UDP-RECVFROM`, but only supports IPv6 protocol.
Option groups: `FD`,`SOCKET`,`IP6`,`CHILD`,`RANGE`

`UDP-RECV:<port>`
Creates a UDP socket on `<port>` [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.
Note: if you need the fork option, use `UDP-RECVFROM` in unidirectional mode (with option `-u`) instead.
Option groups: `FD`,`SOCKET`,`IP4`,`IP6`,`RANGE`
Useful options: `pf`, `bind`, `sourceport`, `ttl`, `tos`
See also: `UDP4-RECV`, `UDP6-RECV`, `UDP-SENDTO`, `UDP-RECVFROM`, `UDP-CONNECT`, `UDP-LISTEN`, `IP-RECV`, `UNIX-RECV`

`UDP4-RECV:<port>`
Like `UDP-RECV`, but only supports IPv4 protocol.
Option groups: `FD`,`SOCKET`,`IP4`,`RANGE`

`UDP6-RECV:<port>`
Like `UDP-RECV`, but only supports IPv6 protocol.
Option groups: `FD`,`SOCKET`,`IP6`,`RANGE`

`UNIX-CONNECT:<filename>`
Connects to `<filename>` assuming it is a UNIX domain socket. If `<filename>` does not exist, this is an error; if `<filename>` is not a UNIX domain socket, this is an error; if `<filename>` is a UNIX domain socket, but no process is listening, this is an error.
Option groups: `FD`,`SOCKET`,`NAMED`,`RETRY`,`UNIX`
Useful options: `bind`
See also: `UNIX-LISTEN`, `UNIX-SENDTO`, `TCP`

`UNIX-LISTEN:<filename>`
Listens on `<filename>` using a UNIX domain stream socket and accepts a connection. If `<filename>` exists and is not a socket, this is an error. If `<filename>` 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).
Option groups: `FD`,`SOCKET`,`NAMED`,`LISTEN`,`CHILD`,`RETRY`,`UNIX`
Useful options: `fork`, `umask`, `mode`, `user`, `group`, `unlink-early`
See also: `UNIX-CONNECT`, `UNIX-RECVFROM`, `UNIX-RECV`, `TCP-LISTEN`

`UNIX-SENDTO:<filename>`
Communicates with the specified peer socket, defined by `[<filename>]` 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 (eg. `/tmp/sock1`, which must not exist before). This address type works well with socat `UNIX-RECVFROM` and `UNIX-RECV` address peers.
Option groups: `FD`,`SOCKET`,`NAMED`,`UNIX`
Useful options: `bind`
See also: `UNIX-RECVFROM`, `UNIX-RECV`, `UNIX-CONNECT`, `UDP-SENDTO`, `IP-SENDTO`

`UNIX-RECVFROM:<filename>`
Creates a UNIX domain datagram socket `[<filename>]`. 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.
Option groups: `FD`,`SOCKET`,`NAMED`,`CHILD`,`UNIX`
Useful options: `fork`
See also: `UNIX-SENDTO`, `UNIX-RECV`, `UNIX-LISTEN`, `UDP-RECVFROM`, `IP-RECVFROM`

`UNIX-RECV:<filename>`
Creates a UNIX domain datagram socket `[<filename>]`. Receives packets from multiple unspecified peers and merges the data. No replies are possible. It can be, e.g., addressed by socat `UNIX-SENDTO` address peers. It behaves similar to a syslog server.
Option groups: `FD`,`SOCKET`,`NAMED`,`UNIX`
See also: `UNIX-SENDTO`, `UNIX-RECVFROM`, `UNIX-LISTEN`, `UDP-RECV`, `IP-RECV`

`UNIX-CLIENT:<filename>`
Communicates with the specified peer socket, defined by `[<filename>]` 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.
Option groups: `FD`,`SOCKET`,`NAMED`,`UNIX`
Useful options: `bind`
See also: `UNIX-CONNECT`, `UNIX-SENDTO`, `GOPEN`

#### Address Options
Address options can be applied to address specifications to influence the process of opening the addresses and the properties of the resulting data channels.

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 option groups 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.

##### `FD` option group
This option group contains options that are applied to a UNIX style file descriptor, no matter how it was generated. Because all current socat address types are file descriptor based, these options may be applied to any address.
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.

| Option                           | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| -------------------------------- |   |
| `cloexec=<bool>`                 | Sets the `FD_CLOEXEC` flag with the `fcntl()` system call to value `<bool>`. If set, the file descriptor is closed on `exec()` family function calls. Socat internally handles this flag for the fds it controls, so in most cases there will be no need to apply this option.                                                                                                                                                                                                                                                                                                                                                     |
| `setlk`                          | Tries to set a discretionary write lock to the whole file using the `fcntl(fd, F_SETLK, ...)` system call. If the file is already locked, this call results in an error. On Linux, when the file permissions for group are "S" (g-x,g+s), and the file system is locally mounted with the "mand" option, the lock is mandatory, i.e. prevents other processes from opening the file.                                                                                                                                                                                                                                               |
| `setlkw`                         | Tries to set a discretionary waiting write lock to the whole file using the `fcntl(fd, F_SETLKW, ...)` system call. If the file is already locked, this call blocks. See option `setlk` for information about making this lock mandatory.                                                                                                                                                                                                                                                                                                                                                                                          |
| `setlk-rd`                       | Tries to set a discretionary read lock to the whole file using the `fcntl(fd, F_SETLK, ...)` 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.                                                                                                                                                                                                                                                                                                                                                                                 |
| `setlkw-rd`                      | Tries to set a discretionary waiting read lock to the whole file using the `fcntl(fd, F_SETLKW, ...)` system call. If the file is already write locked, this call blocks. See option `setlk` for information about making this lock mandatory.                                                                                                                                                                                                                                                                                                                                                                                     |
| `flock-ex`                       | Tries to set a blocking exclusive advisory lock to the file using the `flock(fd, LOCK_EX)` system call. Socat hangs in this call if the file is locked by another process.                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `flock-ex-nb`                    | Tries to set a nonblocking exclusive advisory lock to the file using the `flock(fd, LOCK_EX                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | LOCK_NB)` system call. If the file is already locked, this option results in an error. |
| `flock-sh`                       | Tries to set a blocking shared advisory lock to the file using the `flock(fd, LOCK_SH)` system call. Socat hangs in this call if the file is locked by another process.                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `flock-sh-nb`                    | Tries to set a nonblocking shared advisory lock to the file using the `flock(fd, LOCK_SH                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | LOCK_NB)` system call. If the file is already locked, this option results in an error. |
| `lock`                           | 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.                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `user=<user>`                    | Sets the `<user>` (owner) of the stream. If the address is member of the `NAMED` option group, socat uses the `chown()` system call after opening the file or binding to the UNIX domain socket (race condition!). Without filesystem entry, socat sets the user of the stream using the `fchown()` system call. These calls might require root privilege.                                                                                                                                                                                                                                                                         |
| `user-late=<user>`               | Sets the owner of the fd to `<user>` with the `fchown()` system call after opening or connecting the channel. This is useful only on file system entries.                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `group=<group>`                  | Sets the `<group>` of the stream. If the address is member of the `NAMED` option group, socat uses the `chown()` system call after opening the file or binding to the UNIX domain socket (race condition!). Without filesystem entry, socat sets the group of the stream with the `fchown()` system call. These calls might require group membership or root privilege.                                                                                                                                                                                                                                                            |
| `group-late=<group>`             | Sets the group of the fd to `<group>` with the `fchown()` system call after opening or connecting the channel. This is useful only on file system entries.                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `mode=<mode>`                    | Sets the `<mode>` (permissions) of the stream. If the address is member of the `NAMED` option group and uses the `open()` or `creat()` call, the mode is applied with these. If the address is member of the `NAMED` option group without using these system calls, socat uses the `chmod()` systemcall after opening the filesystem entry or binding to the UNIX domain socket (race condition!). Otherwise, socat sets the mode of the stream using `fchmod()`. These calls might require ownership or root privilege.                                                                                                           |
| `perm-late=<mode>`               | Sets the permissions of the fd to value `<mode>` using the `fchmod()` system call after opening or connecting the channel. This is useful only on file system entries.                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `append=<bool>`                  | Always writes data to the actual end of file. If the address is member of the `OPEN` option group, socat uses the `O_APPEND` flag with the `open()` system call. Otherwise, socat applies the `fcntl(fd, F_SETFL, O_APPEND)` call.                                                                                                                                                                                                                                                                                                                                                                                                 |
| `nonblock=<bool>`                | Tries to open or use file in nonblocking mode. Its only effects are that the `connect()` 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, socat uses the `O_NONBLOCK` flag with the `open()` systemcall. Otherwise, socat applies the `fcntl(fd, F_SETFL, O_NONBLOCK)` call.                                                                                                                                                                                                                                                   |
| `binary`                         | Opens the file in binary mode to avoid implicit line terminator conversions (Cygwin).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `text`                           | Opens the file in text mode to force implicit line terminator conversions (Cygwin).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `noinherit`                      | Does not keep this file open in a spawned process (Cygwin).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `cool-write`                     | Takes it easy when write fails with `EPIPE` or `ECONNRESET` and logs the message with notice level instead of error. This prevents the log file from being filled with useless error messages when socat is used as a high volume server or proxy where clients often abort the connection. This option is experimental.                                                                                                                                                                                                                                                                                                           |
| `end-close`                      | 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. Normally, socket connections will be ended with `shutdown` which terminates the socket even if it is shared by multiple processes. `close` "unlinks" the socket from the process but keeps it active as long as there are still links from other processes. 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. |
| `shut-none`                      | Changes the (address dependent) method of shutting down the write part of a connection to not do anything.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `shut-down`                      | Changes the (address dependent) method of shutting down the write part of a connection to `shutdown(fd, SHUT_WR)`. Is only useful with sockets.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `shut-close`                     | Changes the (address dependent) method of shutting down the write part of a connection to close.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `shut-null`                      | When one address indicates `EOF`, socat 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.                                                                                                                                                                                                                                                                                                                                                                |
| `null-eof`                       | Normally socat will ignore empty (zero size payload) packets arriving on datagram sockets, so it survives port scans. With this option socat interprets empty datagram packets as `EOF` indicator.                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `ioctl-void=<request>`           | Calls `ioctl()` with the request value as second argument and `NULL` as third argument. This option allows utilizing ioctls that are not explicitly implemented in socat.                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `ioctl-int=<request>:<value>`    | Calls `ioctl()` with the request value as second argument and the integer value as third argument.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `ioctl-intp=<request>:<value>`   | Calls `ioctl()` with the request value as second argument and a pointer to the integer value as third argument.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `ioctl-bin=<request>:<value>`    | Calls `ioctl()` with the request value as second argument and a pointer to the given data value as third argument. This data must be specified in `<dalan>` form.                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `ioctl-string=<request>:<value>` | Calls `ioctl()` with the request value as second argument and a pointer to the given string as third argument.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

##### `NAMED` option group
These options work on file system entries.
Please note that, with UNIX domain client addresses, this means the bind entry, not the target/peer entry.
See also options user, group, and mode.

| Option                | Description                                                                                                                                                                                                                                    |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `user-early=<user>`   | Changes the `<user>` (owner) of the file system entry before accessing it, using the `chown()` system call. This call might require root privilege.                                                                                            |
| `group-early=<group>` | Changes the `<group>` of the file system entry before accessing it, using the `chown()` system call. This call might require group membership or root privilege.                                                                               |
| `perm-early=<mode>`   | Changes the `<mode>` of the file system entry before accessing it, using the `chmod()` system call. This call might require ownership or root privilege.                                                                                       |
| `umask=<mode>`        | Sets the umask of the process to `<mode>` before accessing the file system entry (useful with UNIX domain sockets!). This call might affect all further operations of the socat process!                                                       |
| `unlink-early`        | Unlinks (removes) the file before opening it and even before applying user-early etc.                                                                                                                                                          |
| `unlink`              | Unlinks (removes) the file before accessing it, but after user-early etc.                                                                                                                                                                      |
| `unlink-late`         | Unlinks (removes) the file after opening it to make it inaccessible for other processes after a short race condition.                                                                                                                          |
| `unlink-close`        | Removes 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 1; for created files, opened files, and generic opened files the default is 0. |

##### `OPEN` option group
The OPEN group options allow setting flags with the `open()` system call. E.g., option `creat` sets the `O_CREAT` flag.
See also options append and nonblock.

| Option             | Description                                                                |
| ------------------ | -------------------------------------------------------------------------- |
| `creat=<bool>`     | Creates the file if it does not exist.                                     |
| `dsync=<bool>`     | Blocks `write()` calls until metainfo is physically written to media.      |
| `excl=<bool>`      | With option creat, if file exists this is an error.                        |
| `largefile=<bool>` | On 32 bit systems, allows a file larger than $2^{31}$ bytes.               |
| `noatime`          | Sets the `O_NOATIME` options, so reads do not change the access timestamp. |
| `noctty=<bool>`    | Does not make this file the controlling terminal.                          |
| `nofollow=<bool>`  | Does not follow symbolic links.                                            |
| `nshare=<bool>`    | Does not allow sharing this file with other processes.                     |
| `rshare=<bool>`    | Does not allow other processes to open this file for writing.              |
| `rsync=<bool>`     | Blocks `write()` until metainfo is physically written to media.            |
| `sync=<bool>`      | Blocks `write()` until data is physically written to media.                |
| `rdonly=<bool>`    | Opens the file for reading only.                                           |
| `wronly=<bool>`    | Opens the file for writing only.                                           |
| `trunc`            | Truncates the file to size 0 during opening it.                            |

##### `REG` and `BLK` option group
These options are usually applied to a UNIX file descriptor, but their semantics make sense only on a file supporting random access.

| Option               | Description                                                                                                                                                                                                                    |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `seek=<offset>`      | Applies the `lseek(fd, <offset>, SEEK_SET)` system call, thus positioning the file pointer absolutely to `<offset>`. Please note that a missing value defaults to 1, not 0.                                                    |
| `seek-cur=<offset>`  | Applies the `lseek(fd, <offset>, SEEK_CUR)` system call, thus positioning the file pointer at `<offset>` bytes relatively to its current position (which is usually 0). Please note that a missing value defaults to 1, not 0. |
| `seek-end=<offset>`  | Applies the `lseek(fd, <offset>, SEEK_END)` system call, thus positioning the file pointer `<offset>` bytes relatively to the files current end. Please note that a missing value defaults to 1, not 0.                        |
| `ftruncate=<offset>` | Applies the `ftruncate(fd, <offset>)` system call, thus truncating the file at the position `<offset>`. Please note that a missing value defaults to 1, not 0.                                                                 |

##### `PROCESS` option group
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 socat process.

| Option                     | Description                                                                                                                                                                                                                         |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `chroot=<directory>`       | Performs a `chroot()` operation to `<directory>` after processing the address. This call might require root privilege.                                                                                                              |
| `chroot-early=<directory>` | Performs a `chroot()` operation to `<directory>` before opening the address. This call might require root privilege.                                                                                                                |
| `setgid=<group>`           | Changes the primary `<group>` 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.                                       |
| `setgid-early=<group>`     | Like `setgit` but is performed before opening the address.                                                                                                                                                                          |
| `setuid=<user>`            | Changes the `<user>` (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. |
| `setuid-early=<user>`      | Like `setuid` but is performed before opening the address.                                                                                                                                                                          |
| `su=<user>`                | Changes the `<user>` (owner) and groups of the process after processing the address. This call might require root privilege.                                                                                                        |
| `su-d=<user>`              | Short name for substuser-delayed. Changes the `<user>` (owner) and groups of the process after processing the address. The user and his groups are retrieved before a possible `chroot()` . This call might require root privilege. |
| `setpgid=<pid_t>`          | Makes the process a member of the specified process group `<pid_t>`. If no value is given, or if the value is 0 or 1, the process becomes leader of a new process group.                                                            |
| `setsid`                   | Makes the process the leader of a new session.                                                                                                                                                                                      |

##### `APPLICATION` option group
This group contains options that work at data level. Note that these options only apply to the "raw" data transferred by socat, but not to protocol data used by addresses like `PROXY`.

| Option                | Description                                                                                                                                                             |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cr`                  | Converts the default line termination character NL (`\n`, `0x0a`) to/from CR (`\r`, `0x0d`) when writing/reading on this channel.                                       |
| `crnl`                | Converts the default line termination character NL (`\n`, `0x0a`) to/from CRNL (`\r\n`, `0x0d0a`) when writing/reading on this channel.                                 |
| `ignoreeof`           | When `EOF` occurs on this channel, socat ignores it and tries to read more data (like "tail -f").                                                                       |
| `readbytes=<bytes>`   | socat 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. |
| `lockfile=<filename>` | If lockfile exists, exits with error. If lockfile does not exist, creates it and continues, unlinks lockfile on exit.                                                   |
| `waitlock=<filename>` | If lockfile exists, waits until it disappears. When lockfile does not exist, creates it and continues, unlinks lockfile on exit.                                        |
| `escape=<int>`        | Specifies the numeric code of a character that triggers `EOF` on the input stream. It is useful with a terminal in raw mode.                                            |

##### `SOCKET` option group
These options are intended for all kinds of sockets, e.g. IP or UNIX domain. Most are applied with a `setsockopt()` call.

| Option                                         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ---------------------------------------------- |   |
| `bind=<sockname>`                              | Binds the socket to the given socket address using the `bind()` system call. The form of `<sockname>` is socket domain dependent: IP4 and IP6 allow the form `[hostname                                                                                                                                                                                                                                                                                                                                                                                                                                                  | hostaddress][:(service | port)]`, UNIX domain sockets require `<filename>`, VSOCK allow the form `[cid][:(port)]`. |
| `connect-timeout=<seconds>`                    | Abort the connection attempt after `<seconds>` with error status.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `so-bindtodevice=<interface>`                  | Binds the socket to the given `<interface>`. This option might require root privilege.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `broadcast`                                    | For datagram sockets, allows sending to broadcast addresses and receiving packets addressed to broadcast addresses.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `debug`                                        | Enables socket debugging.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `dontroute`                                    | Only communicates with directly connected peers, does not use routers.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `keepalive`                                    | Enables sending keepalives on the socket.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `linger=<seconds>`                             | Blocks `shutdown()` or `close()` until data transfers have finished or the given timeout expired.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `oobinline`                                    | Places out-of-band data in the input data stream.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `priority=<priority>`                          | Sets the protocol defined `<priority>` for outgoing packets.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `rcvbuf=<bytes>`                               | Sets the size of the receive buffer after the `socket()` call to `<bytes>`. With TCP sockets, this value corresponds to the socket`s maximal window size.                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `rcvbuf-late=<bytes>`                          | Sets the size of the receive buffer when the socket is already connected to `<bytes>`. With TCP sockets, this value corresponds to the socket`s maximal window size.                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `rcvlowat=<bytes>`                             | Specifies the minimum number of received bytes until the socket layer will pass the buffered data to socat.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `reuseaddr`                                    | Allows other sockets to bind to an address even if parts of it (e.g. the local port) are already in use by socat.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `sndbuf=<bytes>`                               | Sets the size of the send buffer after the socket() call to `<bytes>`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `sndbuf-late=<bytes>`                          | Sets the size of the send buffer when the socket is connected to `<bytes>`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `sndlowat=<bytes>`                             | Specifies the minimum number of bytes in the send buffer until the socket layer will send the data to `<bytes>`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `pf=<string>`                                  | Forces the use of the specified IP version or protocol. `<string>` can be something like `ip4` or `ip6`. The resulting value is used as first argument to the `socket()` or `socketpair()` calls. This option affects address resolution and the required syntax of bind and range options.                                                                                                                                                                                                                                                                                                                              |
| `type=<type>`                                  | Sets the type of the socket, specified as second argument to the `socket()` or `socketpair()` calls, to `<type>`. Address resolution is not affected by this option. Under Linux, 1 means stream oriented socket, 2 means datagram socket, and 3 means raw socket.                                                                                                                                                                                                                                                                                                                                                       |
| `protocol`                                     | Sets the protocol of the socket, specified as third argument to the `socket()` or `socketpair()` calls, to `<protocol>`. Address resolution is not affected by this option. 6 means TCP, 17 means UDP.                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `reuseport`                                    | Set the `SO_REUSEPORT` socket option.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `so-timestamp`                                 | Sets the `SO_TIMESTAMP` socket option. This enables receiving and logging of timestamp ancillary messages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `setsockopt=<level>:<optname>:<optval>`        | Invokes `setsockopt()` for the socket with the given parameters. level is used as second argument to `setsockopt()` and specifies the layer, e.g. SOL_TCP for TCP (6 on Linux), or SOL_SOCKET for the socket layer (1 on Linux). optname  is the third argument to `setsockopt()` and tells which socket option is to be set. For the actual numbers you might have to look up the appropriate include files of your system. For the 4th and 5th `setsockopt()` parameters, value specifies an arbitrary sequence of bytes that are passed to the function per pointer, with the automatically derived length parameter. |
| `setsockopt-int=<level>:<optname>:<optval>`    | Like `setsockopt`, but `<optval>` is a pointer to int                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `setsockopt-listen=<level>:<optname>:<optval>` | Like `setsockopt`, but for listen type addresses it is applied to the listening socket instead of the connected socket.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `setsockopt-string=<level>:<optname>:<optval>` | Like `setsockopt`, but `<optval>` is a string. This string is passed to the function with trailing null character, and the length parameter is automatically derived from the data.                                                                                                                                                                                                                                                                                                                                                                                                                                      |

##### `IP4` and `IP6` option groups
These options can be used with IPv4 and IPv6 based sockets.

| Option                       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `tos=<tos>`                  | Sets the TOS (type of service) field of outgoing packets to `<tos>` `[byte]` (see RFC 791).                                                                                                                                                                                                                                                                                                                                                    |
| `ttl=<ttl>`                  | Sets the TTL (time to live) field of outgoing packets to `<ttl>`.                                                                                                                                                                                                                                                                                                                                                                              |
| `ip-options=<data>`          | Sets IP options like source routing. Must be given in binary form, recommended format is a leading "x" followed by an even number of hex digits. This option may be used multiple times, data are appended. E.g., to connect to host 10.0.0.1 via some gateway using a loose source route, use the gateway as address parameter and set a loose source route using the option `ip-options=x8307040a000001`. IP options are defined in RFC 791. |
| `ip-pktinfo`                 | Sets the `IP_PKTINFO` socket option. This enables receiving and logging of ancillary messages containing destination address and interface (Linux).                                                                                                                                                                                                                                                                                            |
| `ip-recverr`                 | Sets the `IP_RECVERR` socket option. This enables receiving and logging of ancillary messages containing detailed error information.                                                                                                                                                                                                                                                                                                           |
| `ip-recvopts`                | Sets the `IP_RECVOPTS` socket option. This enables receiving and logging of IP options ancillary messages (Linux, *BSD).                                                                                                                                                                                                                                                                                                                       |
| `ip-recvtos`                 | Sets the `IP_RECVTOS` socket option. This enables receiving and logging of TOS (type of service) ancillary messages (Linux).                                                                                                                                                                                                                                                                                                                   |
| `ip-recvttl`                 | Sets the `IP_RECVTTL` socket option. This enables receiving and logging of TTL (time to live) ancillary messages (Linux, *BSD).                                                                                                                                                                                                                                                                                                                |
| `ip-recvdstaddr`             | Sets the `IP_RECVDSTADDR` socket option. This enables receiving and logging of ancillary messages containing destination address (*BSD).                                                                                                                                                                                                                                                                                                       |
| `ip-recvif`                  | Sets the `IP_RECVIF` socket option. This enables receiving and logging of interface ancillary messages (*BSD).                                                                                                                                                                                                                                                                                                                                 |
| `ip-multicast-if=<hostname>` | Specifies hostname or address of the network interface to be used for multicast traffic.                                                                                                                                                                                                                                                                                                                                                       |
| `ip-multicast-loop=<bool>`   | Specifies if outgoing multicast traffic should loop back to the interface.                                                                                                                                                                                                                                                                                                                                                                     |
| `ip-multicast-ttl=<byte>`    | Sets the TTL used for outgoing multicast traffic. Default is 1.                                                                                                                                                                                                                                                                                                                                                                                |
| `ip-transparent`             | Sets the `IP_TRANSPARENT` socket option. This option might require root privilege.                                                                                                                                                                                                                                                                                                                                                             |

##### `IP6` option group
These options can only be used on IPv6 based sockets. See IP options for options that can be applied to both IPv4 and IPv6 sockets.

| Option                                    | Description                                                                                                                                                   |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ipv6only=<bool>`                         | Sets the `IPV6_V6ONLY` socket option. If 0, the TCP stack will also accept connections using IPv4 protocol on the same port. The default is system dependent. |
| `ipv6-recvdstopts`                        | Sets the `IPV6_RECVDSTOPTS` socket option. This enables receiving and logging of ancillary messages containing the destination options.                       |
| `ipv6-recvhoplimit`                       | Sets the `IPV6_RECVHOPLIMIT` socket option. This enables receiving and logging of ancillary messages containing the hoplimit.                                 |
| `ipv6-recvhopopts`                        | Sets the `IPV6_RECVHOPOPTS` socket option. This enables receiving and logging of ancillary messages containing the hop options.                               |
| `ipv6-recvpktinfo`                        | Sets the `IPV6_RECVPKTINFO` socket option. This enables receiving and logging of ancillary messages containing destination address and interface.             |
| `ipv6-unicast-hops=link(TYPE_INT)(<int>)` | Sets the `IPV6_UNICAST_HOPS` socket option. This sets the hop count limit (TTL) for outgoing unicast packets.                                                 |
| `ipv6-recvrthdr`                          | Sets the `IPV6_RECVRTHDR` socket option. This enables receiving and logging of ancillary messages containing routing information.                             |
| `ipv6-tclass`                             | Sets the `IPV6_TCLASS` socket option. This sets the transfer class of outgoing packets.                                                                       |
| `ipv6-recvtclass`                         | Sets the `IPV6_RECVTCLASS` socket option. This enables receiving and logging of ancillary messages containing the transfer class.                             |

##### `TCP` option group
These options may be applied to TCP sockets. They work by invoking `setsockopt()` with the appropriate parameters.

| Option                | Description                                                                                                                                         |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cork`                | Doesn`t send packets smaller than MSS (maximal segment size).                                                                                       |
| `defer-accept`        | While listening, accepts connections only when data from the peer arrived.                                                                          |
| `keepcnt=<count>`     | Sets the number of keepalives before shutting down the socket to `<count>`.                                                                         |
| `keepidle=<seconds>`  | Sets the idle time before sending the first keepalive to `<seconds>`.                                                                               |
| `keepintvl=<seconds>` | Sets the interval between two keepalives to `<seconds>`.                                                                                            |
| `linger2=<seconds>`   | Sets the time to keep the socket in FIN-WAIT-2 state to `<seconds>`.                                                                                |
| `mss=<bytes>`         | Sets the MSS (maximum segment size) after the `socket()` call to `<bytes>`. This value is then proposed to the peer with the SYN or SYN/ACK packet. |
| `mss-late=<bytes>`    | Sets the MSS of the socket after connection has been established to `<bytes>`.                                                                      |
| `nodelay`             | Turns off the Nagle algorithm for measuring the RTT (round trip time).                                                                              |
| `rfc1323`             | Enables RFC1323 TCP options: TCP window scale, round-trip time measurement (RTTM), and protect against wrapped sequence numbers (PAWS) (AIX).       |
| `stdurg`              | Enables RFC1122 compliant urgent pointer handling (AIX).                                                                                            |
| `syncnt=<count>`      | Sets the maximal number of SYN retransmits during connect to `<count>`.                                                                             |
| `md5sig`              | Enables generation of MD5 digests on the packets (FreeBSD).                                                                                         |
| `noopt`               | Disables use of TCP options (FreeBSD, MacOSX).                                                                                                      |
| `nopush`              | sets the `TCP_NOPUSH` socket option (FreeBSD, MacOSX).                                                                                              |
| `sack-disable`        | Disables use the selective acknowledge feature (OpenBSD).                                                                                           |
| `signature-enable`    | Enables generation of MD5 digests on the packets (OpenBSD).                                                                                         |
| `paws`                | Enables the "protect against wrapped sequence numbers" feature (Tru64).                                                                             |
| `sackena`             | Enables selective acknowledge (Tru64).                                                                                                              |
| `tsoptena`            | Enables the time stamp option that allows RTT recalculation on existing connections (Tru64).                                                        |

##### `UDP` option group
This option may be applied to UDP datagram sockets.

| Option                 | Description                                                                                                                                                           |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `udp-ignore-peerport>` | Address `UDP-DATAGRAM` expects incoming responses to come from the port specified in its second parameter. With this option, it accepts packets coming from any port. |

##### `UDP`, `TCP`, and `SCTP` option group
Here we find options that are related to the network port mechanism and thus can be used with UDP, TCP, and SCTP client and server addresses.

| Option              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sourceport=<port>` | For outgoing (client) TCP and UDP connections, it sets the source `<port>` using an extra `bind()` call. With TCP or UDP listen addresses, socat immediately shuts down the connection if the client does not use this sourceport. `UDP-RECV`, `UDP-RECVFROM`, `UDP-SENDTO`, and `UDP-DATAGRAM` addresses ignore the packet when it does not match.                                                                                                                          |
| `lowport`           | Outgoing (client) TCP and UDP connections with this option use an unused random source port between 640 and 1023 incl. On UNIX class operating systems, this requires root privilege, and thus indicates that the client process is authorized by local root. TCP and UDP listen addresses with this option immediately shut down the connection if the client does not use a sourceport <= 1023. This mechanism can provide limited authorization under some circumstances. |

##### `SOCKS` option group
When using SOCKS type addresses, some socks specific options can be set.

| Option                    | Description                                                                                                            |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `socksport=<tcp service>` | Overrides the default "socks" service or port 1080 for the socks server port with `<TCP service>`.                     |
| `socksuser=<user>`        | Sends the `<user>` in the username field to the socks server. Default is the actual user name (`$LOGNAME` or `$USER`). |

##### `HTTP` option group
Options that can be provided with HTTP type addresses. The only HTTP address currently implemented is proxy-connect.

| Option                                      | Description                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `proxyport=<TCP service>`                   | Overrides the default HTTP proxy port 8080 with `<TCP service>`.                                                                                                                                                                                                                                                                                                          |
| `ignorecr`                                  | The HTTP protocol requires the use of CR+NL as line terminator. When a proxy server violates this standard, socat might not understand its answer. This option directs socat to interprete NL as line terminator and to ignore CR in the answer. Nevertheless, socat sends CR+NL to the proxy.                                                                            |
| `proxy-authorization=<username>:<password>` | Provide "basic" authentication to the proxy server. The argument to the option is used with a `Proxy-Authorization: Basic` header in base64 encoded form. *Note*: username and password are visible for every user on the local machine in the process list; username and password are transferred to the proxy server unencrypted (base64 encoded) and might be sniffed. |
| `proxy-authorization-file=<filename>`       | Like option `proxy-authorization`, but the credentials are read from the file and therefore not visible in the process list.                                                                                                                                                                                                                                              |
| `resolve`                                   | Per default, socat sends to the proxy a CONNECT request containing the target hostname. With this option, socat resolves the hostname locally and sends the IP address. Please note that, according to RFC 2396, only name resolution to IPv4 addresses is implemented.                                                                                                   |

##### `RANGE` option group
These options check if a connecting client should be granted access. They can be applied to listening and receiving network sockets. tcp-wrappers options fall into this group.

| Option                        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `range=<address-range>`       | After accepting a connection, tests if the peer is within range. For IPv4 addresses, address-range takes the form address/bits, e.g. `10.0.0.0/8`, or address:mask, e.g. `10.0.0.0:255.0.0.0`; for IPv6, it is `[ip6-address]/bits`, e.g. `[::1]/128`. If the client address does not match, socat refuses the connection attempt, issues a warning, and keeps listening/receiving.                                                                                                                       |
| `tcpwrap[=<name>]`            | Use libwrap (tcpd) library to determine if the client is allowed to connect. The configuration files are `/etc/hosts.allow` and `/etc/hosts.deny` per default, see `man 5 hosts_access` for more information. The optional `<name>` (type string) is passed to the wrapper functions as daemon process name. If omitted, the basename of socats invocation (`argv[0]`) is passed. If both tcpwrap and range options are applied to an address, both conditions must be fulfilled to allow the connection. |
| `allow-table=<filename>`      | Takes the specified file instead of `/etc/hosts.allow`.                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `deny-table=<filename>`       | Takes the specified file instead of `/etc/hosts.deny`.                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `tcpwrap-etc=<directoryname>` | Looks for `hosts.allow` and `hosts.deny` in the specified directory. Is overridden by options hosts-allow and hosts-deny.                                                                                                                                                                                                                                                                                                                                                                                 |

##### `LISTEN` option group
Options specific to listening sockets.

| Option                     | Description                                                                             |
| -------------------------- | --------------------------------------------------------------------------------------- |
| `backlog=<count>`          | Sets the backlog value passed with the listen() system call to `<count>`. Default is 5. |
| `accept-timeout=<seconds>` | End waiting for a connection after `<seconds>` with error status.                       |
| `max-children=<count>`     | Limits the number of concurrent child processes. Default is no limit.                   |

##### `CHILD` option group
Options for addresses with multiple connections via child processes.

| Option | Description                                                                                                                                                                                  |
| ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `fork` | After establishing a connection, handles its channel in a child process and keeps the parent process attempting to produce more connections, either by listening or by connecting in a loop. |

##### `EXEC` option group
Options for addresses that invoke a program.

| Option          | Description                                                                                                                                     |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `path=<string>` | Overrides the `$PATH` environment variable for searching the program with `<string>`. This `$PATH` value is effective in the child process too. |
| `login`         | Prefixes `argv[0]` for the `execvp()` call with `-`, thus making a shell behave as login shell.                                                 |

##### `FORK` option group
`EXEC` or `SYSTEM` addresses invoke a program using a child process and transfer data between socat and the program. The interprocess communication mechanism can be influenced with the following options. Per default, a `socketpair()` is created and assigned to stdin and stdout of the child process, while stderr is inherited from the socat process, and the child process uses file descriptors 0 and 1 for communicating with the main socat process.

| Option                        | Description                                                                                                                                                                                                                                               |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `nofork`                      | Does not fork a subprocess for executing the program, instead calls `execvp()` or `system()` directly from the actual socat instance. This avoids the overhead of another process between the program and its peer, but introduces a lot of restrictions. |
| `pipes`                       | Creates a pair of unnamed pipes for interprocess communication instead of a socket pair.                                                                                                                                                                  |
| `openpty`                     | Establishes communication with the sub process using a pseudo terminal created with `openpty()` instead of the default (socketpair or ptmx).                                                                                                              |
| `ptmx`                        | Establishes communication with the sub process using a pseudo terminal created by opening `/dev/ptmx` or `/dev/ptc` instead of the default (socketpair).                                                                                                  |
| `pty`                         | Establishes communication with the sub process using a pseudo terminal instead of a socket pair. Creates the pty with an available mechanism. If openpty and ptmx are both available, it uses ptmx because this is POSIX compliant.                       |
| `ctty`                        | Makes the pty the controlling tty of the sub process.                                                                                                                                                                                                     |
| `stderr`                      | Directs stderr of the sub process to its output channel by making stderr a `dup()` of stdout.                                                                                                                                                             |
| `fdin=<fdnum>`                | Assigns the sub processes input channel to its file descriptor `<fdnum>` instead of stdin (0). The program started from the subprocess has to use this fd for reading data from socat.                                                                    |
| `fdout=<fdnum>`               | Assigns the sub processes output channel to its file descriptor `<fdnum>` instead of stdout (1). The program started from the subprocess has to use this fd for writing data to socat.                                                                    |
| `sighup`, `sigint`, `sigquit` | Has socat pass signals of this type to the sub process. If no address has this option, socat terminates on these signals.                                                                                                                                 |

##### `PTY` option group
These options are intended for use with the pty address type.

| Option                   | Description                                                                                                                                                                                                                                                                                                                                                                                |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `link=<filename>`        | Generates a symbolic link that points to the actual pseudo terminal (pty). This might help to solve the problem that ptys are generated with more or less unpredictable names, making it difficult to directly access the socat generated pty automatically. With this option, the user can specify a "fix" point in the file hierarchy that helps him to access the actual pty (example). |
| `wait-slave`             | Blocks the open phase until a process opens the slave side of the pty. Usually, socat continues after generating the pty with opening the next address or with entering the transfer loop. With the `wait-slave` option, socat waits until some process opens the slave side of the pty before continuing.                                                                                 |
| `pty-interval=<seconds>` | When the `wait-slave` option is set, socat periodically checks the HUP condition using poll() to find if the pty`s slave side has been opened. The default polling interval is 1s. Use the pty-interval option `[timeval]` to change this value.                                                                                                                                           |

##### `OPENSSL` option group
These options apply to the openssl and openssl-listen address types.

| Option                | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| --------------------- |   |
| `cipher=<cipherlist>` | Selects the list of ciphers that may be used for the connection. See the man page of ciphers , section CIPHER LIST FORMAT, for detailed information about syntax, values, and default of `<cipherlist>`. Several cipher strings may be given, separated by `:`. Some simple cipher strings: `3DES` Uses a cipher suite with triple DES. `MD5` Uses a cipher suite with MD5. `aNULL` Uses a cipher suite without authentication. `NULL` Does not use encryption. `HIGH` Uses a cipher suite with "high" encryption. Note that the peer must support the selected property, or the negotiation will fail. |
| `verify=<bool>`       | Controls check of the peer`s certificate. Default is 1 (true). Disabling verify might open your socket for everyone, making the encryption useless!                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `cert=<filename>`     | Specifies the file with the certificate and private key for authentication. The certificate must be in OpenSSL format (`*.pem`). With openssl-listen, use of this option is strongly recommended. Except with cipher `aNULL`, "no shared ciphers" error will occur when no certificate is given.                                                                                                                                                                                                                                                                                                        |
| `key=<filename>`      | Specifies the file with the private key. The private key may be in this file or in the file given with the cert option. The party that has to proof that it is the owner of a certificate needs the private key.                                                                                                                                                                                                                                                                                                                                                                                        |
| `dhparams=<filename>` | Specifies the file with the Diffie Hellman parameters. These parameters may also be in the file given with the cert option in which case the dhparams option is not needed.                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `cafile=<filename>`   | Specifies the file with the trusted (root) authority certificates. The file must be in PEM format and should contain one or more certificates. The party that checks the authentication of its peer trusts only certificates that are in this file.                                                                                                                                                                                                                                                                                                                                                     |
| `capath=<dirname>`    | Specifies the directory with the trusted (root) certificates. The directory must contain certificates in PEM format and their hashes (see OpenSSL documentation)                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `egd=<filename>`      | On some systems, openssl requires an explicit source of random data. Specify the socket name where an entropy gathering daemon like egd provides random data, e.g. `/dev/egd-pool`.                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `compress`            | Enable or disable the use of compression for a connection. Setting this to "none" disables compression, setting it to "auto" lets OpenSSL choose the best available algorithm supported by both parties. The default is to not touch any compression-related settings.                                                                                                                                                                                                                                                                                                                                  |
| `commonname=<string>` | Specify the commonname that the peer certificate must match. With OPENSSL-CONNECT address this overrides the given hostname or IP target address; with OPENSSL-LISTEN this turns on check of peer certificates commonname. This option has only meaning when option verify is not disabled and the chosen cipher provides a peer certificate.                                                                                                                                                                                                                                                           |
| `no-sni=<bool>`       | Do not use the client side Server Name Indication (SNI) feature that selects the desired server certificate.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `snihost=<string>`    | Set the client side Server Name Indication (SNI) host name different from the addressed server name or common name. This might be useful when the server certificate has multiple host names or wildcard names because the SNI host name is passed in cleartext to the server and might be eavesdropped; with this option a mock name of the desired certificate may be transferred.                                                                                                                                                                                                                    |

##### `RETRY` option group
Options that control retry of some system calls, especially connection attempts.

| Option                | Description                                                                                                       |
| --------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `retry=<num>`         | Number of retries before the connection or listen attempt is aborted. Default is 0, which means just one attempt. |
| `interval=<timespec>` | Time between consecutive attempts (seconds, `[timespec]`). Default is 1 second.                                   |
| `forever`             | Performs an unlimited number of retry attempts.                                                                   |

##### `TUN` option group
Options that control Linux TUN/TAP interface device addresses.

| Option                     | Description                                                                                                                                                                                                                       |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `tun-device=<device-file>` | Instructs socat to take another path for the TUN clone device. Default is `/dev/net/tun`.                                                                                                                                         |
| `tun-name=<if-name>`       | Gives the resulting network interface a specific name instead of the system generated (tun0, tun1, etc.)                                                                                                                          |
| `tun-type=[tun/tap]`       | Sets the type of the TUN device; use this option to generate a TAP device. See the Linux docu for the difference between these types. When you try to establish a tunnel between two TUN devices, their types should be the same. |
| `iff-no-pi`                | Sets the IFF_NO_PI flag which controls if the device includes additional packet information in the tunnel. When you try to establish a tunnel between two TUN devices, these flags should have the same values.                   |
| `iff-up`                   | Sets the TUN network interface status UP. Strongly recommended.                                                                                                                                                                   |
| `iff-broadcast`            | Sets the BROADCAST flag of the TUN network interface.                                                                                                                                                                             |
| `iff-debug`                | Sets the DEBUG flag of the TUN network interface.                                                                                                                                                                                 |
| `iff-loopback`             | Sets the LOOPBACK flag of the TUN network interface.                                                                                                                                                                              |
| `iff-pointopoint`          | Sets the POINTOPOINT flag of the TUN device.                                                                                                                                                                                      |
| `iff-notrailers`           | Sets the NOTRAILERS flag of the TUN device.                                                                                                                                                                                       |
| `iff-running`              | Sets the RUNNING flag of the TUN device.                                                                                                                                                                                          |
| `iff-noarp`                | Sets the NOARP flag of the TUN device.                                                                                                                                                                                            |
| `iff-promisc`              | Sets the PROMISC flag of the TUN device.                                                                                                                                                                                          |
| `iff-allmulti`             | Sets the ALLMULTI flag of the TUN device.                                                                                                                                                                                         |
| `iff-master`               | Sets the MASTER flag of the TUN device.                                                                                                                                                                                           |
| `iff-slave`                | Sets the SLAVE flag of the TUN device.                                                                                                                                                                                            |
| `iff-multicast`            | Sets the MULTICAST flag of the TUN device.                                                                                                                                                                                        |
| `iff-portsel`              | Sets the PORTSEL flag of the TUN device.                                                                                                                                                                                          |
| `iff-automedia`            | Sets the AUTOMEDIA flag of the TUN device.                                                                                                                                                                                        |
| `iff-dynamic`              | Sets the DYNAMIC flag of the TUN device.                                                                                                                                                                                          |

## Examples
Connect to [TCP](../../../internet/TCP.md) port 80 on the local or remote system. In this case, socat transfers data between STDIO (`-`) and a TCP4 connection to port 80 on a host named www.example.com:
```shell
socat - TCP4:www.example.com:80
```

Use socat as a [TCP](../../../internet/TCP.md) port forwarder. This example listens on port 81, accepts connections, and forwards the connections to port 80 on the remote host:
```shell
socat TCP4-LISTEN:81,fork,reuseaddr TCP4:TCP4:192.168.1.10:80
```
