socat

socat

CONTENTS 目录

NAME 名称
SYNOPSIS 概要
DESCRIPTION 描述
OPTIONS 选项
ADDRESS SPECIFICATIONS 地址规范
ADDRESS TYPES 地址类型
ADDRESS OPTIONS 地址选项
DATA VALUES 数据值
EXAMPLES 示例
DIAGNOSTICS 诊断
FILES 文件
ENVIRONMENT VARIABLES 环境变量
CREDITS 鸣谢
VERSION 版本
BUGS
SEE ALSO 参见

NAME 名称

socat - Multipurpose relay (SOcket CAT)
socat - 多功能中继(SOcket CAT)

SYNOPSIS 概要

socat [options] <address> <address>
socat -V
socat -h[h[h]] | -?[?[?]]
filan
procan

DESCRIPTION 描述

Socat is a command line based utility that establishes two bidirectional byte streams and transfers data between them. Because the streams can be constructed from a large set of different types of data sinks and sources (see address types), and because lots of address options may be applied to the streams, socat can be used for many different purposes.
Socat 是一个基于命令行的实用程序,用于建立两个双向字节流并在它们之间传输数据。由于这些流可以由大量不同类型的数据汇和源构建(请参阅地址类型),并且可以对这些流应用许多地址选项,因此 socat 可用于许多不同的目的。

Filan is a utility that prints information about its active file descriptors to stdout. It has been written for debugging socat, but might be useful for other purposes too. Use the -h option to find more infos.
Filan 是一个实用程序,将有关其活动文件描述符的信息打印到标准输出。它已经为调试 socat 而编写,但也可能对其他目的有用。使用 -h 选项查找更多信息。

Procan is a utility that prints information about process parameters to stdout. It has been written to better understand some UNIX process properties and for debugging socat, but might be useful for other purposes too.
Procan 是一个实用程序,用于将有关进程参数的信息打印到标准输出。它已经被编写用于更好地理解一些 UNIX 进程属性和调试 socat,但也可能对其他目的有用。

The life cycle of a socat instance typically consists of four phases.
一个 socat 实例的生命周期通常包括四个阶段。

In the init phase, the command line options are parsed and logging is initialized.
在初始化阶段,解析命令行选项并初始化日志记录。

During the open phase, socat opens the first address and afterwards the second address. These steps are usually blocking; thus, especially for complex address types like socks, connection requests or authentication dialogs must be completed before the next step is started.
在打开阶段,socat 首先打开第一个地址,然后打开第二个地址。这些步骤通常是阻塞的;因此,特别是对于像 socks、连接请求或身份验证对话框这样复杂的地址类型,必须在下一步开始之前完成。

In the transfer phase, socat watches both streams' read and write file descriptors via select() , and, when data is available on one side and can be written to the other side, socat reads it, performs newline character conversions if required, and writes the data to the write file descriptor of the other stream, then continues waiting for more data in both directions.
在传输阶段,socat 通过 select() 监视两个流的读取和写入文件描述符,当一侧有数据可用且可以写入另一侧时,socat 会读取数据,如果需要进行换行字符转换,则执行该操作,并将数据写入另一个流的写文件描述符,然后继续等待双向更多数据。

When one of the streams effectively reaches EOF, the closing phase begins. Socat transfers the EOF condition to the other stream, i.e. tries to shutdown only its write stream, giving it a chance to terminate gracefully. For a defined time socat continues to transfer data in the other direction, but then closes all remaining channels and terminates.
当其中一个流有效地达到 EOF 时,关闭阶段开始。Socat 将 EOF 条件传输到另一个流,即尝试仅关闭其写入流,使其有机会优雅地终止。在一定时间内,socat 继续在另一个方向传输数据,然后关闭所有剩余通道并终止。

OPTIONS 选项

Socat provides some command line options that modify the behaviour of the program. They have nothing to do with so called address options that are used as parts of address specifications.
Socat 提供了一些命令行选项,可以修改程序的行为。它们与所谓的地址选项无关,这些选项用作地址规范的一部分。

-V
Print version and available feature information to stdout, and exit.
打印版本和可用功能信息到标准输出,并退出。

-h | -?
Print a help text to stdout describing command line options and available address types, and exit.
打印帮助文本到标准输出,描述命令行选项和可用地址类型,然后退出。

-hh | -??
Like -h, plus a list of the short names of all available address options. Some options are platform dependend, so this output is helpful for checking the particular implementation.
类似于 -h,再加上所有可用地址选项的简称列表。一些选项是平台相关的,因此此输出对于检查特定实现非常有帮助。

-hhh | -???
Like -hh, plus a list of all available address option names.
类似于 -hh,再加上所有可用地址选项名称的列表。

-d
Without this option, only fatal, error, and warning messages are printed; applying this option also prints notice messages. See DIAGNOSTICS for more information.
没有此选项,只会打印致命、错误和警告消息;应用此选项还会打印通知消息。有关更多信息,请参阅诊断。

-d0
With this option, only fatal and error messages are printed; this restores the behaviour of socat up to version 1.7.4.
使用此选项,只会打印致命和错误消息;这恢复了 socat 版本 1.7.4 之前的行为。

-d -d | -dd | -d2
Prints fatal, error, warning, and notice messages.
打印致命、错误、警告和通知消息。

-d -d -d | -ddd | -d3
Prints fatal, error, warning, notice, and info messages.
打印致命错误、错误、警告、通知和信息消息。

-d -d -d -d | -dddd | -d4
Prints fatal, error, warning, notice, info, and debug messages.
打印致命错误、错误、警告、通知、信息和调试消息。

-D
Logs information about file descriptors before starting the transfer phase.
在开始传输阶段之前记录有关文件描述符的信息。

--experimental
New features that are not well tested or are subject to change in the future must me explicitely enabled using this option.
新功能必须经过充分测试或可能会在未来更改,必须使用此选项明确启用。

-ly[<facility>]
Writes messages to syslog instead of stderr; severity as defined with -d option. With optional <facility>, the syslog type can be selected, default is "daemon". Third party libraries might not obey this option.
将消息写入 syslog 而不是 stderr;严重性由 -d 选项定义。使用可选的 <facility>,可以选择 syslog 类型,默认为 "daemon"。第三方库可能不遵守此选项。

-lf <logfile>
Writes messages to <logfile> [filename] instead of stderr. Some third party libraries, in particular libwrap, might not obey this option.
将消息写入 <logfile> [文件名] 而不是 stderr。某些第三方库,特别是 libwrap,可能不遵守此选项。

-ls
Writes messages to stderr (this is the default). Some third party libraries might not obey this option, in particular libwrap appears to only log to syslog.
将消息写入 stderr(这是默认设置)。一些第三方库可能不遵守此选项,特别是 libwrap 似乎只记录到 syslog。

-lp<progname>
Overrides the program name printed in error messages and used for constructing environment variable names.
覆盖错误消息中打印的程序名称,并用于构建环境变量名称。

-lu
Extends the timestamp of error messages to microsecond resolution. Does not work when logging to syslog.
将错误消息的时间戳扩展到微秒分辨率。在记录到 syslog 时不起作用。

-lm[<facility>]
Mixed log mode. During startup messages are printed to stderr; when socat starts the transfer phase loop or daemon mode (i.e. after opening all streams and before starting data transfer, or, with listening sockets with fork option, before the first accept call), it switches logging to syslog. With optional <facility>, the syslog type can be selected, default is "daemon".
混合日志模式。在启动期间,消息将打印到 stderr;当 socat 开始传输阶段循环或守护程序模式(即在打开所有流并开始数据传输之后,或者在具有 fork 选项的监听套接字中,在第一次接受调用之前),它将日志记录切换到 syslog。使用可选的 <facility>,可以选择 syslog 类型,默认为 "daemon"。

-lh
Adds hostname to log messages. Uses the value from environment variable HOSTNAME or the value retrieved with uname() if HOSTNAME is not set.
将主机名添加到日志消息中。使用环境变量 HOSTNAME 的值或者如果未设置 HOSTNAME,则使用从 uname() 检索的值。

-v
Writes the transferred data not only to their target streams, but also to stderr. The output format is text with some conversions for readability, and prefixed with "> " or "< " indicating flow directions.
将传输的数据不仅写入其目标流,还写入 stderr。输出格式为文本,具有一些用于可读性的转换,并以 "> " 或 "< " 为前缀,指示流向。

-x
Writes the transferred data not only to their target streams, but also to stderr. The output format is hexadecimal, prefixed with "> " or "< " indicating flow directions. Can be combined with -v .
将传输的数据不仅写入其目标流,还写入 stderr。输出格式为十六进制,以"> "或"< "开头,表示流向。可以与 -v 结合使用。

-r <file>
Dumps the raw (binary) data flowing from left to right address to the given file. The file name may contain references to environment variables and $$ (pid), $PROGNAME (see option option -lp), $TIMESTAMP (uses format %Y%m%dT%H%M%S), and MICROS (microseconds of daytime). These references have to be protected from shell expansion of course.
将从左到右地址流动的原始(二进制)数据转储到给定文件中。文件名可能包含对环境变量和 $$ (pid)、 $PROGNAME (参见选项 -lp)、 $TIMESTAMP (使用格式 %Y%m%dT%H%M%S)和 MICROS (白天微秒)的引用。当然,这些引用必须受到 shell 扩展的保护。

-R <file>
Dumps the raw (binary) data flowing from right to left address to the given file. See option -r for customization of file name.
将从右到左地址流动的原始(二进制)数据转储到给定文件中。请参见选项 -r 以自定义文件名。

-b<size>
Sets the data transfer block <size> [size_t]. At most <size> bytes are transferred per step. Default is 8192 bytes.
设置数据传输块<size> [ size_t]。每步最多传输<size>字节。默认为 8192 字节。

-s
By default, socat terminates when an error occurred to prevent the process from running when some option could not be applied. With this option, socat is sloppy with errors and tries to continue. Even with this option, socat will exit on fatals, and will abort connection attempts when security checks failed.
默认情况下,socat 在发生错误时终止,以防止某些选项无法应用时进程继续运行。使用此选项,socat 对错误宽松处理并尝试继续。即使使用此选项,socat 也会在发生致命错误时退出,并在安全检查失败时中止连接尝试。

-S<signals-bitmap>
Changes the set of signals that are caught by socat just for printing an log message. This catching is useful to get the information about the signal into socats log, but prevents core dump or other standard actions. The default set of these signals is SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGBUS, SIGFPE, SIGSEGV, and SIGTERM; replace this set (0x89de on Linux) with a bitmap (e.g., SIGFPE has value 8 and its bit is 0x0080).
更改 socat 捕获的信号集,仅用于打印日志消息。此捕获对于将信号信息记录到 socat 日志中很有用,但会阻止核心转储或其他标准操作。这些信号的默认集合是 SIGHUP、SIGINT、SIGQUIT、SIGILL、SIGABRT、SIGBUS、SIGFPE、SIGSEGV 和 SIGTERM;用位图(例如,SIGFPE 的值为 8,其位为 0x0080)替换此集合(在 Linux 上为 0x89de)。

Note: Signals SIGHUP, SIGINT, SIGQUIT, SIGUSR1, SIGPIPE, SIGALRM, SIGTERM, and SIGCHLD may be handled specially anyway.
注意: 信号 SIGHUP、SIGINT、SIGQUIT、SIGUSR1、SIGPIPE、SIGALRM、SIGTERM 和 SIGCHLD 可能会被特殊处理。

-t<timeout>
When one channel has reached EOF, the write part of the other channel is shut down. Then, socat waits <timeout> [timeval] seconds before terminating. Default is 0.5 seconds. This timeout only applies to addresses where write and read part can be closed independently. When during the timeout interval the read part gives EOF, socat terminates without awaiting the timeout.
当一个通道已经到达 EOF 时,另一个通道的写部分将被关闭。然后,socat 在终止之前等待 <timeout> [ timeval] 秒。默认为 0.5 秒。此超时仅适用于可以独立关闭写和读部分的地址。在超时间隔期间,如果读部分给出 EOF,则 socat 将在不等待超时的情况下终止。

-T<timeout>
Total inactivity timeout: when socat is already in the transfer loop and nothing has happened for <timeout> [timeval] seconds (no data arrived, no interrupt occurred...) then it terminates. Useful with protocols like UDP that cannot transfer EOF.
总不活动超时: 当 socat 已经在传输循环中,并且在 <timeout> [ timeval] 秒内没有发生任何事情(没有数据到达,没有中断发生...)时,它将终止。对于像 UDP 这样无法传输 EOF 的协议非常有用。

-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 reading.
在反向方向上使用单向模式。第一个地址仅用于写入,第二个地址仅用于读取。

-g
During address option parsing, don't check if the option is considered useful in the given address environment. Use it if you want to force, e.g., appliance of a socket option to a serial device.
在地址选项解析期间,不检查该选项在给定地址环境中是否被认为有用。如果要强制使用,例如将套接字选项应用于串行设备,请使用它。

-L<lockfile>
If lockfile exists, exits with error. If lockfile does not exist, creates it and continues, unlinks lockfile on exit.
如果锁定文件存在,则以错误退出。如果锁定文件不存在,则创建它并继续,在退出时取消链接锁定文件。

-W<lockfile>
If lockfile exists, waits until it disappears. When lockfile does not exist, creates it and continues, unlinks lockfile on exit.
如果锁定文件存在,则等待直到它消失。当锁定文件不存在时,创建它并继续,在退出时取消链接锁定文件。

-4
Use IP version 4 in case the addresses do not implicitly or explicitly specify a version. Since version 1.8.0 the default is no preference.
如果地址没有明确或隐式指定版本,则使用 IP 版本 4。自版本 1.8.0 起,默认值为无偏好。

-6
Use IP version 6 in case the addresses do not implicitly or explicitly specify a version.
如果地址没有明确或明确指定版本,请使用 IP 版本 6。

--statistics

-S
Logs transfer statistics (bytes and blocks counters for both directions) before terminating socat.
在终止 socat 之前,传输日志传输统计信息(双向字节和块计数器)。

See also signal USR1.
另请参阅信号 USR1。

This feature is experimental and might change in future versions.
这个功能是实验性的,可能会在未来的版本中更改。

ADDRESS SPECIFICATIONS 地址规范

With the address command line arguments, the user gives socat instructions and the necessary information for establishing the byte streams.
通过地址命令行参数,用户提供了 socat 指令和建立字节流所需的信息。

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.
关键字指定地址类型(例如,TCP4,OPEN,EXEC)。对于一些关键字,存在同义词(STDIO 的同义词为'-',TCP4 的同义词为 TCP)。关键字不区分大小写。对于一些特殊的地址类型,关键字可能被省略:以数字开头的地址规范被假定为 FD(原始文件描述符)地址;如果在第一个冒号或逗号之前发现'/',则假定为 GOPEN(通用文件打开)。

The required number and type of address parameters depend on the address type. E.g., TCP4 requires a server specification (name or address), and a port specification (number or service name).
必需的地址参数的数量和类型取决于地址类型。例如,TCP4 需要服务器规范(名称或地址)和端口规范(数字或服务名称)。

Zero or more address options may be given with each address. They influence the address in some ways. Options consist of an option keyword or an option keyword and a value, separated by '='. Option keywords are case insensitive. For filtering the options that are useful with an address type, each option is member of one option group. For each address type there is a set of option groups allowed. Only options belonging to one of these address groups may be used (except with option -g).
每个地址可以附带零个或多个地址选项。它们以某种方式影响地址。选项由选项关键字或选项关键字和值组成,用 '=' 分隔。选项关键字不区分大小写。为了过滤与地址类型有用的选项,每个选项都是一个选项组的成员。对于每种地址类型,都允许一组选项组。只能使用属于这些地址组之一的选项(除了选项 -g)。

Address specifications following the above schema are also called single address specifications. Two single addresses can be combined with "!!" to form a dual type address for one channel. Here, the first address is used by socat for reading data, and the second address for writing data. There is no way to specify an option only once for being applied to both single addresses.
遵循上述模式的地址规范也称为单地址规范。两个单地址可以用 "!!" 结合在一起,形成一个通道的双类型地址。在这里,第一个地址由 socat 用于读取数据,第二个地址用于写入数据。无法指定一个选项仅应用于两个单地址。

Usually, addresses are opened in read/write mode. When an address is part of a dual address specification, or when option -u or -U is used, an address might be used only for reading or for writing. Considering this is important with some address types.
通常,地址以读/写模式打开。当地址是双地址规范的一部分,或者使用选项 -u 或 -U 时,地址可能仅用于读取或写入。考虑到这一点对于某些地址类型很重要。

With socat version 1.5.0 and higher, the lexical analysis tries to handle quotes and parenthesis meaningfully and allows escaping of special characters. If one of the characters ( { [ ' is found, the corresponding closing character - ) } ] ' - is looked for; they may also be nested. Within these constructs, socats special characters and strings : , !! are not handled specially. All those characters and strings can be escaped with \ or within ""
从 socat 版本 1.5.0 及更高版本开始,词法分析尝试处理引号和括号的含义,并允许转义特殊字符。如果发现其中一个字符({ [ '),则会寻找相应的闭合字符 - ) } ] ' -;它们也可以嵌套。在这些结构内,socat 的特殊字符和字符串:,!! 不会被特殊处理。所有这些字符和字符串都可以用 \ 转义或在 "" 内部。

ADDRESS TYPES 地址类型

This section describes the available address types with their keywords, parameters, and semantics.
本节描述了可用的地址类型及其关键字、参数和语义。

CREATE:<filename>
Opens <filename> with creat() and uses the file descriptor for writing. This is a write-only address because a file opened with creat cannot be read from. See options -u and -U, and dual addresses.
使用 creat() 打开 并使用文件描述符进行写入。这是一个只写地址,因为使用 creat 打开的文件无法读取。请参见选项 -u 和 -U,以及双地址。

Flags like O_LARGEFILE cannot be applied. If you need them use OPEN with options create,create.
无法应用类似 O_LARGEFILE 的标志。如果需要它们,请使用带有选项 create, create 的 OPEN。

<filename> must be a valid existing or not existing path. If <filename> is a named pipe, creat() might block; if <filename> refers to a socket, this is an error.
必须是有效的现有或不存在的路径。如果 是一个命名管道, creat() 可能会阻塞;如果 指向一个套接字,这将是一个错误。

Option groups: FD,REG,NAMED
选项组: FD, REG, NAMED

Useful options: mode, user, group, unlink-early, unlink-late, append
有用选项: 模式, 用户, 组, 提前取消链接, 晚取消链接, 追加

See also: OPEN, GOPEN
另请参阅: OPEN, GOPEN

DCCP-CONNECT:<host>:<port> (DCCP:<host>:<port>)
Establishes a DCCP connect to the specified <host> [IP address] and <port> [DCCP service] using IP version 4 or 6 depending on address specification, name resolution, or option pf.
建立到指定 <host> [IP 地址] 和 <port> [DCCP 服务] 的 DCCP 连接,根据地址规范、名称解析或选项 pf 使用 IP 版本 4 或 6。

Option groups: FD,SOCKET,IP4,IP6,SCTP,CHILD,RETRY
选项组:FD、SOCKET、IP4、IP6、SCTP、CHILD、RETRY

Useful options: bind, connect-timeout, tos, dccp-set-ccid, nonblock, sourceport, retry, readbytes
有用的选项:bind、connect-timeout、tos、dccp-set-ccid、nonblock、sourceport、retry、readbytes

See also: DCCP4-CONNECT, DCCP6-CONNECT, DCCP-LISTEN, TCP-CONNECT SCTP-CONNECT
参见:DCCP4-CONNECT,DCCP6-CONNECT,DCCP-LISTEN,TCP-CONNECT SCTP-CONNECT

DCCP4-CONNECT:<host>:<port> (DCCP4:<host>:<port>)
Like DCCP-CONNECT, but only supports IPv4 protocol.
类似于 DCCP-CONNECT,但仅支持 IPv4 协议。

Option groups: FD,SOCKET,IP4,DCCP,CHILD,RETRY
选项组:FD,SOCKET,IP4,DCCP,CHILD,RETRY

DCCP6-CONNECT:<host>:<port> (DCCP6:<host>:<port>)
Like DCCP-CONNECT, but only supports IPv6 protocol.
类似于 DCCP-CONNECT,但仅支持 IPv6 协议。

Option groups: FD,SOCKET,IP6,DCCP,CHILD,RETRY
选项组:FD,SOCKET,IP6,DCCP,CHILD,RETRY

DCCP-LISTEN:<port> (DCCP-L:<port>)
Listens on <port> [DCCP service] and accepts an DCCP connection. The IP version is 4 or the one specified with address option pf, socat option (-4, -6), or environment variable SOCAT_DEFAULT_LISTEN_IP. Note that opening this address usually blocks until a client connects.
在<端口>上监听[DCCP 服务]并接受 DCCP 连接。IP 版本为 4 或使用地址选项 pf、socat 选项(-4,-6)或环境变量 SOCAT_DEFAULT_LISTEN_IP 指定的版本。请注意,打开此地址通常会阻塞,直到客户端连接。

Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6,DCCP,RETRY
选项组: FD, SOCKET, LISTEN, CHILD, RANGE, IP4, IP6, DCCP, RETRY

Useful options: fork, bind, range, max-children, backlog, accept-timeout, dccp-set-sid, su, reuseaddr, retry
有用选项: fork, bind, range, max-children, backlog, accept-timeout, dccp-set-sid, su, reuseaddr, retry

See also: DCCP4-LISTEN, DCCP6-LISTEN, TCP-LISTEN, SCTP-LISTEN, DCCP-CONNECT
另请参阅: DCCP4-LISTEN, DCCP6-LISTEN, TCP-LISTEN, SCTP-LISTEN, DCCP-CONNECT

DCCP4-LISTEN:<port> (DCCP4-L:<port>)
Like DCCP-LISTEN, but only supports IPv4 protocol.
仅支持 IPv4 协议的类似 DCCP-LISTEN。

Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,DCCP,RETRY
选项组:FD、SOCKET、LISTEN、CHILD、RANGE、IP4、DCCP、RETRY

DCCP6-LISTEN:<port> (DCCP6-L:<port>)
Like DCCP-LISTEN, but only supports IPv6 protocol.
仅支持 IPv6 协议的类似 DCCP-LISTEN。

Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP6,DCCP,RETRY
选项组: FD, SOCKET, LISTEN, CHILD, RANGE, IP6, DCCP, RETRY

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]. If the program name is a relative path, the execvp() semantics for finding the program via $PATH apply. After successful program start, socat writes data to stdin of the process and reads from its stdout using a UNIX domain socket generated by socketpair() per default. (example)
分叉一个子进程,与其父进程建立通信,并使用 execvp() 调用指定的程序。 是一个简单的命令,参数之间用单个空格分隔。如果程序名称包含 '/', 则最后一个 '/' 后面的部分被视为 ARGV[0]。如果程序名称是相对路径,则使用 $PATH 应用程序查找的 execvp() 语义。成功启动程序后,socat 使用 socketpair() 默认生成的 UNIX 域套接字向进程的 stdin 写入数据,并从其 stdout 读取数据。 (示例)

Option groups: FD,SOCKET,EXEC,FORK,TERMIOS
选项组: FD, SOCKET, EXEC, FORK, TERMIOS

Useful options: path, fdin, fdout, chroot, su, su-d, nofork, socktype, pty, stderr, ctty, setsid, pipes, umask, login, sigint, sigquit, netns
有用的选项:路径,fdin,fdout,chroot,su,su-d,nofork,socktype,pty,stderr,ctty,setsid,pipes,umask,login,sigint,sigquit,netns

See also: SYSTEM,SHELL
另请参阅:系统,外壳

FD:<fdnum>
Uses the file descriptor <fdnum>. It must already exist as valid UN*X file descriptor.
使用文件描述符<fdnum>。它必须已经存在为有效的 UNIX 文件描述符。

Option groups: FD (TERMIOS,REG,SOCKET)
选项组: FD ( TERMIOS, REG, SOCKET)

See also: STDIO, STDIN, STDOUT, STDERR
另请参阅: 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. If it already exists, its type is checked. In case of a UNIX domain socket, socat connects; if connecting fails, socat assumes a datagram socket and uses sendto() calls. If the entry is not a socket, socat opens it applying the O_APPEND flag. If it does not exist, it is opened with flag O_CREAT as a regular file (example).
(通用打开) 此地址类型尝试有用地处理除目录之外的任何文件系统条目。 <文件名> 可以是相对路径或绝对路径。 如果它已经存在,则会检查其类型。 如果是 UNIX 域套接字,socat 将连接; 如果连接失败,socat 假定是数据报套接字并使用 sendto() 调用。 如果条目不是套接字,socat 将以 O_APPEND 标志打开它。 如果它不存在,则将以 O_CREAT 标志作为常规文件打开它(示例)。

Option groups: FD,REG,SOCKET,NAMED,OPEN
选项组: FD, REG, SOCKET, NAMED, OPEN

See also: OPEN, CREATE, UNIX-CONNECT
另请参阅: 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.
打开原始 IP 套接字。根据主机规范或选项 pf,使用 IP 协议版本 4 或 6。它使用 <protocol> 发送数据包到 <host> [IP 地址] 并从主机接收数据包,忽略其他主机发送的数据包。协议 255 使用带有 IP 头部的原始套接字。

Option groups: FD,SOCKET,IP4,IP6
选项组: FD, SOCKET, IP4, IP6

Useful options: pf, ttl
有用的选项: pf, ttl

See also: IP4-SENDTO, IP6-SENDTO, IP-RECVFROM, IP-RECV, UDP-SENDTO, UNIX-SENDTO
另请参阅: IP4-SENDTO, IP6-SENDTO, IP-RECVFROM, IP-RECV, UDP-SENDTO, UNIX-SENDTO

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.
使用原始数据包与通过接口连接的网络进行通信,包括链路级数据。 <interface> 是网络接口的名称。目前仅在 Linux 上可用。

Option groups: FD,SOCKET
选项组:FD,SOCKET

Useful options: pf, type
有用选项:pf,类型

See also: ip-recv
参见:ip-recv

IP4-SENDTO:<host>:<protocol>
Like IP-SENDTO, but always uses IPv4.
类似于 IP-SENDTO,但始终使用 IPv4。

Option groups: FD,SOCKET,IP4
选项组:FD,SOCKET,IP4

IP6-SENDTO:<host>:<protocol>
Like IP-SENDTO, but always uses IPv6.
类似于 IP-SENDTO,但始终使用 IPv6。

Option groups: FD,SOCKET,IP6
选项组:FD,SOCKET,IP6

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.
将传出数据发送到指定地址,该地址可能是广播或组播地址。到达本地套接字的数据包将被检查,以查看它们的源地址是否与 RANGE 或 TCPWRAP 选项匹配。例如,此地址类型可用于实现对称或非对称广播或组播通信。

Option groups: FD, SOCKET, IP4, IP6, RANGE
选项组: 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, ipv6-join-group, ipv6-join-source-group, ttl, tos, pf
有用的选项: bind, range, tcpwrap, broadcast, ip-multicast-loop, ip-multicast-ttl, ip-multicast-if, ip-add-membership, ip-add-source-membership, ipv6-join-group, ipv6-join-source-group, ttl, tos, pf

See also: IP4-DATAGRAM, IP6-DATAGRAM, IP-SENDTO, IP-RECVFROM, IP-RECV, UDP-DATAGRAM
另请参阅: IP4-DATAGRAM, IP6-DATAGRAM, IP-SENDTO, IP-RECVFROM, IP-RECV, UDP-DATAGRAM

IP4-DATAGRAM:<host>:<protocol>
Like IP-DATAGRAM, but always uses IPv4. (example)
像 IP 数据报一样,但始终使用 IPv4。(示例)

Option groups: FD,SOCKET,IP4,RANGE
选项组:FD、SOCKET、IP4、RANGE

IP6-DATAGRAM:<host>:<protocol>
Like IP-DATAGRAM, but always uses IPv6. Please note that IPv6 does not know broadcasts.
像 IP 数据报一样,但始终使用 IPv6。请注意,IPv6 不支持广播。

Option groups: FD,SOCKET,IP6,RANGE
选项组: 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.
打开一个原始 IP 套接字 <protocol>。根据选项 pf,将使用 IP 协议版本 4 或 6。它从未指定的对等方接收一个数据包,并可能向该对等方发送一个或多个应答数据包。此模式特别适用于 fork 选项,其中每个到达的数据包 - 来自任意对等方 - 都由自己的子进程处理。这允许类似于典型基于 UDP 的服务器(如 ntpd 或 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.
请注意,当发送方和接收方的 IP 地址相同时,回复数据包可能被视为传入流量,因为没有端口号来区分套接字。

This address works well with IP-SENDTO address peers (see above). Protocol 255 uses the raw socket with the IP header being part of the data.
这个地址与 IP-SENDTO 地址对等方很好地配合(见上文)。协议 255 使用原始套接字,其中 IP 头部是数据的一部分。

See the note about RECVFROM addresses.
请参阅关于 RECVFROM 地址的说明。

Option groups: FD,SOCKET,IP4,IP6,CHILD,RANGE
选项组:FD、SOCKET、IP4、IP6、CHILD、RANGE

Useful options: pf, fork, range, ttl, broadcast
有用的选项:pf、fork、range、ttl、broadcast

See also: IP4-RECVFROM, IP6-RECVFROM, IP-SENDTO, IP-RECV, UDP-RECVFROM, UNIX-RECVFROM
另请参阅:IP4-RECVFROM、IP6-RECVFROM、IP-SENDTO、IP-RECV、UDP-RECVFROM、UNIX-RECVFROM

IP4-RECVFROM:<protocol>
Like IP-RECVFROM, but always uses IPv4.
类似于 IP-RECVFROM,但始终使用 IPv4。

Option groups: FD,SOCKET,IP4,CHILD,RANGE
选项组:FD,套接字,IP4,子级,范围

IP6-RECVFROM:<protocol>
Like IP-RECVFROM, but always uses IPv6.
类似于 IP-RECVFROM,但始终使用 IPv6。

Option groups: FD,SOCKET,IP6,CHILD,RANGE
选项组:FD,套接字,IP6,子级,范围

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, this is a read-only address, see options -u and -U, and dual addresses. It can be, e.g., addressed by socat IP-SENDTO address peers. Protocol 255 uses the raw socket with the IP header being part of the data.
打开一个 <protocol> 的原始 IP 套接字。根据选项 pf,将使用 IP 协议版本 4 或 6。它从多个未指定的对等方接收数据包并合并数据。不可能回复,这是一个只读地址,请参阅选项 -u 和 -U,以及双地址。例如,可以通过 socat IP-SENDTO 地址对对等方进行寻址。协议 255 使用带有 IP 头部的原始套接字。

Option groups: FD,SOCKET,IP4,IP6,RANGE
选项组:FD、SOCKET、IP4、IP6、RANGE

Useful options: pf, range
有用的选项:pf、range

See also: IP4-RECV, IP6-RECV, IP-SENDTO, IP-RECVFROM, UDP-RECV, UNIX-RECV
参见:IP4-RECV,IP6-RECV,IP-SENDTO,IP-RECVFROM,UDP-RECV,UNIX-RECV

IP4-RECV:<protocol>
Like IP-RECV, but always uses IPv4.
类似于 IP-RECV,但始终使用 IPv4。

Option groups: FD,SOCKET,IP4,RANGE
选项组:FD,SOCKET,IP4,RANGE

IP6-RECV:<protocol>
Like IP-RECV, but always uses IPv6.
类似于 IP-RECV,但始终使用 IPv6。

Option groups: FD,SOCKET,IP6,RANGE
选项组:FD,SOCKET,IP6,RANGE

OPEN:<filename>
Opens <filename> using the open() system call (example). This operation fails on UNIX domain sockets.
使用 open() 系统调用打开 (示例)。此操作在 UNIX 域套接字上失败。

Note: This address type is rarely useful in bidirectional mode.
注意:此地址类型在双向模式下很少有用。

Option groups: FD,REG,NAMED,OPEN
选项组:FD、REG、NAMED、OPEN

Useful options: creat, excl, noatime, nofollow, append, rdonly, wronly, lock, readbytes, ignoreeof
有用选项:creat、excl、noatime、nofollow、append、rdonly、wronly、lock、readbytes、ignoreeof

See also: CREATE, GOPEN, UNIX-CONNECT
另请参阅: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.
尝试使用 TCP/IP 版本 4 或 6(取决于地址规范、名称解析或选项 pf)在 <host> [IP 地址] 上的 <port> [TCP 服务] 建立 SSL 连接。

NOTE: Up to version 1.7.2.4 the server certificate was only checked for validity against the system certificate store or cafile or capath, but not for match with the server's name or its IP address. Since version 1.7.3.0 socat checks the peer certificate for match with the <host> parameter or the value of the openssl-commonname option. Socat tries to match it against the certificates subject commonName, and the certificates extension subjectAltName DNS names. Wildcards in the certificate are supported.
注意:在版本 1.7.2.4 之前,服务器证书仅针对系统证书存储区、cafile 或 capath 的有效性进行检查,但不检查与服务器名称或其 IP 地址的匹配。自版本 1.7.3.0 起,socat 会检查对等证书是否与 <host> 参数或 openssl-commonname 选项的值匹配。Socat 会尝试将其与证书的主题 commonName 和证书扩展主题 subjectAltName DNS 名称进行匹配。证书中的通配符受支持。

Option groups: FD,SOCKET,IP4,IP6,TCP,OPENSSL,RETRY
选项组: FD, SOCKET, IP4, IP6, TCP, OPENSSL, RETRY

Useful options: min-proto-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, bind, pf, connect-timeout, sourceport, retry
有用选项: min-proto-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, bind, pf, connect-timeout, sourceport, retry

See also: OPENSSL-LISTEN, TCP
另请参阅: 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.
在 TCP <端口> [TCP 服务] 上监听。IP 版本为 4 或使用 pf 指定的版本。当连接被接受时,此地址将作为 SSL 服务器。

Note: You probably want to use the certificate option with this address.
注意:您可能希望在此地址上使用证书选项。

NOTE: The client certificate is only checked for validity against cafile or capath, but not for match with the client's name or its IP address!
注意:客户端证书仅针对 cafile 或 capath 进行有效性检查,但不检查与客户端名称或 IP 地址的匹配!

Option groups: FD,SOCKET,IP4,IP6,TCP,LISTEN,OPENSSL,CHILD,RANGE,RETRY
选项组: FD, SOCKET, IP4, IP6, TCP, LISTEN, OPENSSL, CHILD, RANGE, RETRY

Useful options: pf, min-proto-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, fork, bind, range, tcpwrap, su, reuseaddr, retry
有用选项: pf, min-proto-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, fork, bind, range, tcpwrap, su, reuseaddr, retry

See also: OPENSSL, TCP-LISTEN
另请参阅: 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.
尝试使用 UDP/IP 版本 4 或 6,根据地址规范、名称解析或选项 pf,在 <host> [IP 地址] 上的 <port> [UDP 服务] 建立 DTLS 连接。

Socat checks the peer certificates subjectAltName or commonName against the addresses option openssl-commonname or the host name. Wildcards in the certificate are supported.
Socat 检查对等证书的 subjectAltName 或 commonName 是否与地址选项 openssl-commonname 或主机名匹配。证书中的通配符受支持。

Use socat option -b to make datagrams small enough to fit with overhead on the network. Use option -T to prevent indefinite hanging when peer went down quietly.
使用 socat 选项 -b 使数据报文足够小,以适应网络开销。使用选项 -T 防止对等方悄悄关闭时出现无限挂起。

Option groups: FD,SOCKET,IP4,IP6,OPENSSL,RETRY
选项组: FD, SOCKET, IP4, IP6, OPENSSL, RETRY

Useful options: min-proto-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, bind, pf, sourceport, retry, rcvtimeo
有用选项: min-proto-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, bind, pf, sourceport, retry, rcvtimeo

See also: OPENSSL-DTLS-SERVER, OPENSSL-CONNECT, UDP-CONNECT
另请参阅: 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.
在 UDP <port> [ UDP 服务] 上进行监听。IP 版本为 4 或使用 pf 指定的版本。当连接被接受时,此地址将作为 DTLS 服务器。

Note: You probably want to use the certificate option with this address.
注意: 您可能希望在此地址上使用证书选项。

NOTE: The client certificate is only checked for validity against cafile or capath, but not for match with the client's name or its IP address! Use socat option -b to make datagrams small enough to fit with overhead on the network. Use option -T to prevent indefinite hanging when peer went down quietly.
注意: 客户端证书仅针对 cafile 或 capath 进行有效性检查,但不检查与客户端名称或其 IP 地址的匹配!使用 socat 选项 -b 使数据报文足够小,以适应网络上的开销。使用选项 -T 防止对等方悄悄关闭时导致无限挂起。

Option groups: FD,SOCKET,IP4,IP6,LISTEN,OPENSSL,CHILD,RANGE,RETRY
选项组: FD, SOCKET, IP4, IP6, LISTEN, OPENSSL, CHILD, RANGE, RETRY

Useful options: pf, min-proto-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, fork, bind, range, tcpwrap, su, reuseaddr, retry
有用选项: pf, min-proto-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, fork, bind, range, tcpwrap, su, reuseaddr, retry

rcvtimeo
See also: OPENSSL-DTLS-CLIENT, OPENSSL-LISTEN, UDP-LISTEN
查看也: 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. Beginning with socat version 1.4.3, the named pipe is removed when the address is closed (but see option unlink-close
如果<filename>已经存在,则打开它。如果不存在,则创建并打开一个命名管道。从 socat 版本 1.4.3 开始,当地址关闭时,命名管道将被删除(但请参阅选项 unlink-close)

Note: When a pipe is used for both reading and writing, it works as echo service.
注意: 当管道用于读写时,它将作为回显服务。

Note: When a pipe is used for both reading and writing, and socat tries to write more bytes than the pipe can buffer (Linux 2.4: 2048 bytes), socat might block. Consider using socat option, e.g., -b 2048
注意: 当管道用于读写时,并且 socat 尝试写入的字节数超过管道可以缓冲的字节数(Linux 2.4: 2048 字节),socat 可能会阻塞。考虑使用 socat 选项,例如, -b 2048

Option groups: FD,NAMED,OPEN
选项组: FD, NAMED, OPEN

Useful options: rdonly, nonblock, group, user, mode, unlink-early
有用的选项: rdonly, nonblock, group, user, mode, unlink-early

See also: unnamed pipe
参见:无名管道

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.
创建一个无名管道,并将其用于读取和写入。它的工作原理类似于回声,因为写入管道的所有内容立即显示为读取数据。

Note: When socat tries to write more bytes than the pipe can queue (Linux 2.4: 2048 bytes), socat might block. Consider, e.g., using option -b 2048
注意:当 socat 尝试写入的字节数超过管道可以排队的字节数(Linux 2.4:2048 字节)时,socat 可能会阻塞。考虑,例如,使用选项 -b 2048

Option groups: FD
选项组: FD

See also: named pipe, SOCKETPAIR
另请参阅: 命名管道,SOCKETPAIR

SOCKETPAIR
Creates a socketpair and uses it for reading and writing. It works as an echo, because everything written to it appeares immediately as read data. The default socket type is datagram, so it keeps packet boundaries.
创建一个 socketpair 并将其用于读取和写入。它的工作方式类似于回声,因为写入的所有内容立即显示为读取数据。默认的套接字类型是数据报,因此它保留数据包边界。

Option groups: FD
选项组: FD

Useful options: socktype
有用的选项: socktype

See also: unnamed pipe
另请参阅: 无名管道

POSIXMQ-READ:/<mqueue>
Opens the specified POSIX message queue and reads messages (packets). It keeps the boundaries.
打开指定的 POSIX 消息队列并读取消息(数据包)。它保持边界。

This is a read-only address, see options -u and -U and dual addresses.
这是一个只读地址,请参阅选项 -u 和 -U 以及双地址。

Socat provides this address type only on Linux because POSIX MQ is based on UNIX filedescriptors there.
Socat 仅在 Linux 上提供此地址类型,因为 POSIX MQ 在那里基于 UNIX 文件描述符。

This feature is new in version 1.8.0.0 and might change in the future, therefore it is experimental.
此功能是在版本 1.8.0.0 中新增的,可能会在未来发生变化,因此它是实验性的。

Useful options: posixmq-priority, unlink-early, unlink-close
有用的选项:posixmq-priority,unlink-early,unlink-close

POSIXMQ-RECEIVE:/<mqueue>

POSIXMQ-RECV:/<mqueue>
Opens the specified POSIX message queue and reads one message (packet).
打开指定的 POSIX 消息队列并读取一个消息(数据包)。

This is a read-only address. See POSIXMQ-READ for more info.
这是一个只读地址。查看 POSIXMQ-READ 以获取更多信息。

Example: POSIX MQ recv with fork
示例:带有 fork 的 POSIX MQ 接收

This feature is experimental.
此功能是实验性的。

Useful options: posixmq-priority, fork, max-children, unlink-early, unlink-close
有用的选项:posixmq-priority,fork,max-children,unlink-early,unlink-close

POSIXMQ-SEND:/<mqueue>
Opens the specified POSIX message queue and writes messages (packets).
打开指定的 POSIX 消息队列并写入消息(数据包)。

This is a write-only address. See POSIXMQ-READ for more info.
这是一个只写地址。有关更多信息,请参阅 POSIXMQ-READ。

(Example) ( 示例)
This feature is experimental.
此功能是实验性的。

Useful options: posixmq-priority, fork, max-children, unlink-early, unlink-close
有用的选项:posixmq-priority,fork,max-children,unlink-early,unlink-close

POSIXMQ-BIDIRECTIONAL:/mqueue
Opens the specified POSIX message queue and writes and reads messages (packet). This is probably rarely useful but has been implemented for functional completeness.
打开指定的 POSIX 消息队列,并写入和读取消息(数据包)。这可能很少有用,但已实现以实现功能完整性。

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 (example). Note that the traffic need not be HTTP but can be an arbitrary protocol.
使用 TCP/IP 版本 4 或 6(取决于地址规范、名称解析或选项 pf)连接到端口 8080 上的 HTTP 代理服务器,并发送主机名:端口的 CONNECT 请求。如果代理授予访问权限并成功连接到目标,socat 和目标之间的数据传输可以开始(示例)。请注意,流量不一定是 HTTP,而可以是任意协议。

Option groups: FD,SOCKET,IP4,IP6,TCP,HTTP,RETRY
选项组:FD、SOCKET、IP4、IP6、TCP、HTTP、RETRY

Useful options: proxyport, ignorecr, proxyauth, resolve, crnl, bind, connect-timeout, mss, sourceport, retry
有用的选项:代理端口,忽略回车,代理认证,解析,回车换行,绑定,连接超时,最大分段大小,源端口,重试

See also: SOCKS, TCP
另请参阅:SOCKS,TCP

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. (example). If both the ptmx and the openpty mechanisms are available, ptmx is used (POSIX).
生成伪终端(pty)并使用其主端。另一个进程可以打开 pty 的从端,像使用串行线路或终端一样(示例)。如果 ptmx 和 openpty 机制都可用,则使用 ptmx(POSIX)。

Option groups: FD,NAMED,PTY,TERMIOS
选项组: FD, NAMED, PTY, TERMIOS

Useful options: link, openpty, wait-slave, mode, user, group
有用的选项: link, openpty, wait-slave, mode, user, group

See also: UNIX-LISTEN, PIPE, EXEC, SYSTEM, SHELL
另请参阅: UNIX-LISTEN, PIPE, EXEC, SYSTEM, SHELL

READLINE
Uses GNU readline and history on stdio to allow editing and reusing input lines (example). This requires the GNU readline and history libraries. Note that stdio should be a (pseudo) terminal device, otherwise readline does not seem to work.
使用 GNU readline 和 history 在 stdio 上允许编辑和重用输入行(示例)。这需要 GNU readline 和 history 库。请注意,stdio 应该是一个(伪)终端设备,否则 readline 似乎无法工作。

Option groups: FD,READLINE,TERMIOS
选项组:FD,READLINE,TERMIOS

Useful options: history, noecho
有用的选项:history,noecho

See also: STDIO
查看也: STDIO

SCTP-CONNECT:<host>:<port>
Establishes an SCTP stream connection to the specified <host> [IP address] and <port> [TCP service] using IP version 4 or 6 depending on address specification, name resolution, or option pf.
使用 IP 版本 4 或 6,根据地址规范、名称解析或选项 pf,向指定的 <host> [IP 地址] 和 <port> [TCP 服务] 建立 SCTP 流连接。

Option groups: FD,SOCKET,IP4,IP6,SCTP,CHILD,RETRY
选项组: FD, SOCKET, IP4, IP6, SCTP, CHILD, RETRY

Useful options: bind, pf, connect-timeout, tos, mtudiscover, sctp-maxseg, sctp-nodelay, nonblock, sourceport, retry, readbytes
有用的选项:bind、pf、connect-timeout、tos、mtudiscover、sctp-maxseg、sctp-nodelay、nonblock、sourceport、retry、readbytes

See also: SCTP4-CONNECT, SCTP6-CONNECT, SCTP-LISTEN, TCP-CONNECT
另请参阅:SCTP4-CONNECT、SCTP6-CONNECT、SCTP-LISTEN、TCP-CONNECT

SCTP4-CONNECT:<host>:<port>
Like SCTP-CONNECT, but only supports IPv4 protocol.
类似于 SCTP-CONNECT,但仅支持 IPv4 协议。

Option groups: FD,SOCKET,IP4,SCTP,CHILD,RETRY
选项组: FD, SOCKET, IP4, SCTP, CHILD, RETRY

SCTP6-CONNECT:<host>:<port>
Like SCTP-CONNECT, but only supports IPv6 protocol.
类似于 SCTP-CONNECT,但仅支持 IPv6 协议。

Option groups: FD,SOCKET,IP6,SCTP,CHILD,RETRY
选项组: FD, SOCKET, IP6, SCTP, CHILD, RETRY

SCTP-LISTEN:<port>
Listens on <port> [TCP service] and accepts an SCTP connection. The IP version is 4 or the one specified with address option pf, socat option (-4, -6), or environment variable SOCAT_DEFAULT_LISTEN_IP. Note that opening this address usually blocks until a client connects.
监听 <端口> [TCP 服务] 并接受 SCTP 连接。IP 版本为 4 或使用地址选项 pf、socat 选项(-4、-6)或环境变量 SOCAT_DEFAULT_LISTEN_IP 指定的版本。请注意,打开此地址通常会阻塞,直到客户端连接。

Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6,SCTP,RETRY
选项组:FD、SOCKET、LISTEN、CHILD、RANGE、IP4、IP6、SCTP、RETRY

Useful options: crnl, fork, bind, range, tcpwrap, pf, max-children, backlog, accept-timeout, sctp-maxseg, sctp-nodelay, su, reuseaddr, retry
有用选项:crnl、fork、bind、range、tcpwrap、pf、max-children、backlog、accept-timeout、sctp-maxseg、sctp-nodelay、su、reuseaddr、retry

See also: SCTP4-LISTEN, SCTP6-LISTEN, TCP-LISTEN, SCTP-CONNECT
参见:SCTP4-LISTEN,SCTP6-LISTEN,TCP-LISTEN,SCTP-CONNECT

SCTP4-LISTEN:<port>
Like SCTP-LISTEN, but only supports IPv4 protocol.
类似于 SCTP-LISTEN,但仅支持 IPv4 协议。

Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,SCTP,RETRY
选项组:FD,SOCKET,LISTEN,CHILD,RANGE,IP4,SCTP,RETRY

SCTP6-LISTEN:<port>
Like SCTP-LISTEN, but only supports IPv6 protocol.
类似于 SCTP-LISTEN,但仅支持 IPv6 协议。

Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP6,SCTP,RETRY
选项组:FD,SOCKET,LISTEN,CHILD,RANGE,IP6,SCTP,RETRY

SOCKET-CONNECT:<domain>:<protocol>:<remote-address>
Creates a stream socket using the first and second given socket parameters and SOCK_STREAM (see man socket(2)) and connects to the remote-address. The two socket parameters have to be specified by int numbers. Consult your OS documentation and include files to find the appropriate values. The remote-address must be the data representation of a sockaddr structure without sa_family and (BSD) sa_len components.
使用第一个和第二个给定的套接字参数以及 SOCK_STREAM (参见 man socket(2))创建一个流套接字,并连接到远程地址。这两个套接字参数必须由 int 数字指定。请查阅您的操作系统文档和包含文件,以找到适当的值。远程地址必须是一个不带 sa_family 和(BSD)sa_len 组件的 sockaddr 结构的数据表示形式。

Please note that you can - beyond the options of the specified groups - also use options of higher level protocols when you apply socat option -g.
请注意,当您应用 socat 选项 -g 时,除了指定组的选项之外,您还可以使用更高级别协议的选项。

Option groups: FD,SOCKET,CHILD,RETRY
选项组:FD,SOCKET,CHILD,RETRY

Useful options: bind, setsockopt,
有用的选项:bind,setsockopt

See also: TCP, UDP-CONNECT, UNIX-CONNECT, SOCKET-LISTEN, SOCKET-SENDTO
参见: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 (see man socket(2)) and sends outgoing data to the remote-address. The three socket parameters have to be specified by int numbers. Consult your OS documentation and include files to find the appropriate values. The remote-address must be the data representation of a sockaddr structure without sa_family and (BSD) sa_len components.
使用前三个给定的套接字参数(参见 man socket(2))创建数据报套接字,并将传出数据发送到远程地址。必须使用 int 数字指定三个套接字参数。请查阅您的操作系统文档和包含文件,以找到适当的值。远程地址必须是不带 sa_family 和(BSD)sa_len 组件的 sockaddr 结构的数据表示。

Please note that you can - beyond the options of the specified groups - also use options of higher level protocols when you apply socat option -g.
请注意,当您应用 socat 选项 -g 时,除了指定组的选项外,还可以使用更高级别协议的选项。

Option groups: FD,SOCKET,RANGE
选项组: FD, SOCKET, RANGE

Useful options: bind, range, setsockopt,
有用的选项: bind, range, setsockopt

See also: UDP-DATAGRAM, IP-DATAGRAM, SOCKET-SENDTO, SOCKET-RECV, SOCKET-RECVFROM
另请参阅: 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 (see man socket(2)) and waits for incoming connections on local-address. The two socket parameters have to be specified by int numbers. Consult your OS documentation and include files to find the appropriate values. The local-address must be the data representation of a sockaddr structure without sa_family and (BSD) sa_len components.
使用第一个和第二个给定的套接字参数以及 SOCK_STREAM (参见 man socket(2))创建流套接字,并在本地地址上等待传入连接。这两个套接字参数必须由整数数字指定。请查阅您的操作系统文档和包含文件以找到适当的值。本地地址必须是不带 sa_family 和(BSD)sa_len 组件的 sockaddr 结构的数据表示。

Please note that you can - beyond the options of the specified groups - also use options of higher level protocols when you apply socat option -g.
请注意,当您应用 socat 选项 -g 时,除了指定组的选项之外,还可以使用更高级别协议的选项。

Option groups: FD,SOCKET,LISTEN,RANGE,CHILD,RETRY
选项组:FD、SOCKET、LISTEN、RANGE、CHILD、RETRY

Useful options: setsockopt, setsockopt-listen,
有用的选项:setsockopt、setsockopt-listen

See also: TCP, UDP-CONNECT, UNIX-CONNECT, SOCKET-LISTEN, SOCKET-SENDTO, SOCKET-SENDTO
另请参阅: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 (see man socket(2)) and binds it to <local-address>. Receives arriving data. The three parameters have to be specified by int numbers. Consult your OS documentation and include files to find the appropriate values. The local-address must be the data representation of a sockaddr structure without sa_family and (BSD) sa_len components.
使用给定的三个套接字参数(参见 man socket(2))创建套接字,并将其绑定到<local-address>。接收到达的数据。这三个参数必须由 int 数字指定。请查阅您的操作系统文档和包含文件,以找到适当的值。local-address 必须是 sockaddr 结构的数据表示形式,不包含 sa_family 和(BSD)sa_len 组件。

Option groups: FD,SOCKET,RANGE
选项组: FD, SOCKET, RANGE

Useful options: range, setsockopt, setsockopt-listen
有用选项: 范围, setsockopt, setsockopt-listen

See also: UDP-RECV, IP-RECV, UNIX-RECV, SOCKET-DATAGRAM, SOCKET-SENDTO, SOCKET-RECVFROM
另请参阅: 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 (see man socket(2)) 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. Consult your OS documentation and include files to find the appropriate values. The local-address must be the data representation of a sockaddr structure without sa_family and (BSD) sa_len components.
使用三个给定的套接字参数(参见 man socket(2))创建套接字并将其绑定到<本地地址>。接收到达的数据并将回复发送回发送者。前三个参数必须指定为 int 数字。请查阅您的操作系统文档和包含文件,以找到适当的值。本地地址必须是不带 sa_family 和(BSD)sa_len 组件的 sockaddr 结构的数据表示。

See the note about RECVFROM addresses.
查看有关 RECVFROM 地址的说明。

Option groups: FD,SOCKET,CHILD,RANGE
选项组:FD、SOCKET、CHILD、RANGE

Useful options: fork, range, setsockopt, setsockopt-listen
有用的选项:fork、range、setsockopt、setsockopt-listen

See also: UDP-RECVFROM, IP-RECVFROM, UNIX-RECVFROM, SOCKET-DATAGRAM, SOCKET-SENDTO, SOCKET-RECV
另请参阅: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 (see man socket(2)). Sends outgoing data to the given address and receives replies. The three parameters have to be specified as int numbers. Consult your OS documentation and include files to find the appropriate values. The remote-address must be the data representation of a sockaddr structure without sa_family and (BSD) sa_len components.
使用三个给定的套接字参数创建套接字(参见 man socket(2))。将传出数据发送到给定地址并接收回复。必须将三个参数指定为 int 数字。请查阅您的操作系统文档和包含文件,以找到适当的值。远程地址必须是不带 sa_family 和(BSD)sa_len 组件的 sockaddr 结构的数据表示形式。

Option groups: FD,SOCKET
选项组: FD, SOCKET

Useful options: bind, setsockopt, setsockopt-listen
有用的选项: bind, setsockopt, setsockopt-listen

See also: UDP-SENDTO, IP-SENDTO, UNIX-SENDTO, SOCKET-DATAGRAM, SOCKET-RECV SOCKET-RECVFROM
另请参阅: UDP-SENDTO, IP-SENDTO, UNIX-SENDTO, SOCKET-DATAGRAM, SOCKET-RECV SOCKET-RECVFROM

ACCEPT-FD:<fdnum>
Expects a listening socket in <fdnum> and accepts one or (with option fork) more connections. This address type is useful under systemd control with "inetd mode".
期望在<fdnum>中有一个监听套接字,并接受一个或多个连接。此地址类型在 systemd 控制下的“inetd 模式”下很有用。

Example: (example) 示例:(示例)
Option groups: FD, SOCKET, TCP, CHILD, RETRY
选项组:FD、SOCKET、TCP、CHILD、RETRY

Useful options: fork, range, sourceport, lowport, tcpwrap
有用的选项:fork、range、sourceport、lowport、tcpwrap

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).
通过 <socks-server> [IP 地址] 连接到 <host> [IPv4 地址] 的 <port> [TCP 服务],使用 socks 版本 4 协议,根据地址规范、名称解析或选项 pf(示例)在 IP 版本 4 或 6 上进行

Option groups: FD,SOCKET,IP4,IP6,TCP,SOCKS4,RETRY
选项组:FD、SOCKET、IP4、IP6、TCP、SOCKS4、RETRY

Useful options: socksuser, socksport, sourceport, pf, retry
有用的选项:socksuser、socksport、sourceport、pf、retry

See also: SOCKS5, SOCKS4A, PROXY, TCP
另请参阅:SOCKS5、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.
类似于 SOCKS4,但使用 socks 协议版本 4a,因此将主机名解析留给 socks 服务器。

Option groups: FD,SOCKET,IP4,IP6,TCP,SOCKS4,RETRY
选项组: FD, SOCKET, IP4, IP6, TCP, SOCKS4, RETRY

SOCKS5-CONNECT:<socks-server>:<socks-port>:<target-host>:<target-port>
Connects via <socks-server> [IP address] to <target-host> [IPv4 address] on <target-port> [TCP service], using socks version 5 protocol over TCP. Currently no authentication mechanism is provided.
通过 <socks-server> [IP 地址] 连接到 <target-host> [IPv4 地址] 的 <target-port> [TCP 服务],使用 TCP 上的 socks 版本 5 协议。目前没有提供认证机制。

This address type is experimental.
此地址类型是实验性的。

Option groups: FD, SOCKET, IP4, IP6, TCP, CHILD, RETRY
选项组: FD, SOCKET, IP4, IP6, TCP, CHILD, RETRY

Useful options: sourceport, pf, retry
有用选项: sourceport, pf, retry

See also: SOCKS5-LISTEN, SOCKS4, SOCKS4A, PROXY, TCP
另请参阅: SOCKS5-LISTEN, SOCKS4, SOCKS4A, PROXY, TCP

SOCKS5-LISTEN:<socks-server>:<socks-port>:<listen-host>:<listen-port>
Connects to <socks-server> [IP address] using socks version 5 protocol over TCP and makes it listen for incoming connections on <listen-port> [TCP service], binding to <-listen-host> [IPv4 address] Currently not authentication mechanism is provided. This address type is experimental. Option groups: FD, SOCKET, IP4, IP6, TCP, CHILD, RETRY
使用 SOCKS 版本 5 协议通过 TCP 连接到 <socks-server> [IP 地址],并使其监听 <listen-port> [TCP 服务] 上的传入连接,绑定到 <-listen-host> [IPv4 地址]。目前没有提供身份验证机制。此地址类型是实验性的。选项组:FD、SOCKET、IP4、IP6、TCP、CHILD、RETRY

Useful options: sourceport, pf, retry
有用的选项:sourceport、pf、retry

See also: SOCKS5-CONNECT,
另请参阅:SOCKS5-CONNECT

STDERR
Uses file descriptor 2.
使用文件描述符 2。

This is a write-only address, see options -u and -U, and dual addresses.
这是一个只写地址,请参阅选项 -u 和 -U,以及双地址。

Option groups: FD (TERMIOS,REG,SOCKET)
选项组:FD(TERMIOS,REG,SOCKET)

See also: FD
另请参阅:FD

STDIN
Uses file descriptor 0.
使用文件描述符 0。

This is a read-only address, see options -u and -U, and dual addresses.
这是一个只读地址,请参阅选项 -u 和 -U,以及双地址。

Option groups: FD (TERMIOS,REG,SOCKET)
选项组: FD (TERMIOS, REG, SOCKET)

Useful options: readbytes
有用选项: readbytes

See also: FD
另请参阅: FD

STDIO
Uses file descriptor 0 for reading, and 1 for writing.
使用文件描述符 0 进行读取,1 进行写入。

Option groups: FD (TERMIOS,REG,SOCKET)
选项组:FD(TERMIOS,REG,SOCKET)

Useful options: readbytes
有用的选项:readbytes

See also: FD
参见:FD

STDOUT
Uses file descriptor 1.
使用文件描述符 1。

This is a write-only address, see options -u and -U, and dual addresses.
这是一个只写地址,请参阅选项 -u 和 -U,以及双地址。

Option groups: FD (TERMIOS,REG,SOCKET)
选项组: FD (TERMIOS, REG, SOCKET)

See also: FD
另请参阅: FD

SHELL:<shell-command>
Forks a sub process that establishes communication with its parent process and invokes the specified program with the configured shell ($SHELL). Note that <shell-command> [string] 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.
分叉一个子进程,与其父进程建立通信,并使用配置的 shell ($SHELL) 调用指定的程序。请注意,<shell-command> [ string] 不能包含 ',' 或 "!!",并且 shell 元字符可能需要保护。成功启动程序后,socat 将数据写入进程的 stdin 并从其 stdout 读取。

Option groups: FD,SOCKET,EXEC,FORK,TERMIOS
选项组: FD, SOCKET, EXEC, FORK, TERMIOS

Useful options: path, fdin, fdout, chroot, su, su-d, nofork, socktype, pty, stderr, ctty, setsid, pipes, umask, sigint, sigquit
有用选项: 路径, fdin, fdout, chroot, su, su-d, nofork, socktype, pty, stderr, ctty, setsid, pipes, umask, sigint, sigquit

See also: EXEC, SYSTEM
另请参阅: EXEC, SYSTEM

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> [string] 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.
创建一个与其父进程建立通信并使用 system() 调用指定程序的子进程。请注意, [字符串] 不能包含','或"!!",并且 shell 元字符可能需要受保护。成功启动程序后,socat 将数据写入进程的 stdin 并从其 stdout 读取。

Option groups: FD,SOCKET,EXEC,FORK,TERMIOS
选项组:FD,SOCKET,EXEC,FORK,TERMIOS

Useful options: path, fdin, fdout, chroot, su, su-d, nofork, socktype, pty, stderr, ctty, setsid, pipes, umask, sigint, sigquit, netns
有用的选项:路径,fdin,fdout,chroot,su,su-d,nofork,socktype,pty,stderr,ctty,setsid,pipes,umask,sigint,sigquit,netns

See also: EXEC, SHELL
参见:EXEC,SHELL

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.
使用基于地址规范、名称解析或选项 pf 的 TCP/IP 版本 4 或 6,在 <host> [IP 地址] 上的 <port> [TCP 服务] 进行连接。

Option groups: FD,SOCKET,IP4,IP6,TCP,RETRY
选项组:FD,SOCKET,IP4,IP6,TCP,RETRY

Useful options: connect-timeout, retry, sourceport, netns, crnl, bind, pf, tos, mtudiscover, mss, nodelay, nonblock, readbytes
有用的选项:连接超时,重试,源端口,netns,crnl,绑定,pf,tos,mtudiscover,mss,nodelay,nonblock,readbytes

See also: TCP4, TCP6, TCP-LISTEN, UDP, SCTP-CONNECT, UNIX-CONNECT
另请参阅:TCP4,TCP6,TCP-LISTEN,UDP,SCTP-CONNECT,UNIX-CONNECT

TCP4:<host>:<port>
Like TCP, but only supports IPv4 protocol (example).
类似于 TCP,但仅支持 IPv4 协议(示例)。

Option groups: FD,SOCKET,IP4,TCP,RETRY
选项组: FD, SOCKET, IP4, TCP, 重试

TCP6:<host>:<port>
Like TCP, but only supports IPv6 protocol.
类似 TCP,但仅支持 IPv6 协议。

Option groups: FD,SOCKET,IP6,TCP,RETRY
选项组: FD, SOCKET, IP6, TCP, 重试

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.
在 <port> [TCP 服务] 上监听并接受 TCP/IP 连接。IP 版本为 4 或使用 address 选项、socat 选项(-4、-6)或环境变量 SOCAT_DEFAULT_LISTEN_IP 指定的版本。请注意,打开此地址通常会阻塞,直到客户端连接。

Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6,TCP,RETRY
选项组: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
有用的选项: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, SCTP-LISTEN, UNIX-LISTEN, OPENSSL-LISTEN, TCP-CONNECT
参见:TCP4-LISTEN,TCP6-LISTEN,UDP-LISTEN,SCTP-LISTEN,UNIX-LISTEN,OPENSSL-LISTEN,TCP-CONNECT

TCP4-LISTEN:<port>
Like TCP-LISTEN, but only supports IPv4 protocol (example).
类似于 TCP-LISTEN,但仅支持 IPv4 协议(示例)。

Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,TCP,RETRY
选项组:FD,SOCKET,LISTEN,CHILD,RANGE,IP4,TCP,RETRY

TCP6-LISTEN:<port>
Like TCP-LISTEN, but only supports IPv6 protocol.
类似于 TCP-LISTEN,但仅支持 IPv6 协议。

Additional useful option: ipv6only
附加有用选项:ipv6only

Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP6,TCP,RETRY
选项组: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!
创建一个 Linux TUN/TAP 设备,并可选择为其分配由参数给定的地址和子网掩码。生成的网络接口几乎可以被其他进程使用;socat 服务于其“线路端”。该地址需要对隧道克隆设备(通常为 /dev/net/tun )具有读写访问权限,以及设置某些 ioctl()s 的权限。选项 iff-up 用于立即激活接口!

Note: If you intend to transfer packets between two Socat "wire sides" you need a protocol that keeps packet boundaries, e.g.UDP; TCP might work with option nodelay.
注意:如果您打算在两个 Socat “线路端”之间传输数据包,您需要一个保持数据包边界的协议,例如 UDP;TCP 可能需要使用选项 nodelay。

Option groups: FD,NAMED,OPEN,TUN
选项组:FD、NAMED、OPEN、TUN

Useful options: iff-up, tun-device, tun-name, tun-type, iff-no-pi, netns
有用的选项:iff-up、tun-device、tun-name、tun-type、iff-no-pi、netns

See also: ip-recv
另请参阅:ip-recv

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.
使用基于地址规范、名称解析或选项 pf 的 UDP/IP 版本 4 或 6 连接到 <host> [IP 地址] 上的 <port> [UDP 服务]。

Please note that, due to UDP protocol properties, no real connection is established; data has to be sent for `connecting' to the server, and no end-of-file condition can be transported.
请注意,由于 UDP 协议的特性,不会建立真正的连接;必须发送数据以进行“连接”到服务器,并且无法传输文件结束条件。

Option groups: FD,SOCKET,IP4,IP6
选项组:FD,SOCKET,IP4,IP6

Useful options: ttl, tos, bind, sourceport, pf
有用的选项:ttl,tos,bind,sourceport,pf

See also: UDP4, UDP6, UDP-LISTEN, TCP, IP
参见:UDP4,UDP6,UDP-LISTEN,TCP,IP

UDP4:<host>:<port>
Like UDP, but only supports IPv4 protocol.
类似于 UDP,但仅支持 IPv4 协议。

Option groups: FD,SOCKET,IP4
选项组:FD,SOCKET,IP4

UDP6:<host>:<port>
Like UDP, but only supports IPv6 protocol.
像 UDP 一样,但仅支持 IPv6 协议。

Option groups: FD,SOCKET,IP6
选项组: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.
将传出数据发送到指定地址,该地址可能是广播或组播地址。当使用选项 sourceport 时,本地套接字上到达的数据包仅在其源地址匹配 RANGE 或 TCPWRAP 选项时才检查正确的远程端口(这是 Socat 版本 1.7.4.0 的更改)。例如,此地址类型可用于实现对称或非对称广播或组播通信。

Option groups: FD,SOCKET,IP4,IP6,RANGE
选项组: 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, ipv6-join-group, ipv6-join-source-group, ttl, tos, sourceport, pf
有用的选项: bind, range, tcpwrap, broadcast, ip-multicast-loop, ip-multicast-ttl, ip-multicast-if, ip-add-membership, ip-add-source-membership, ipv6-join-group, ipv6-join-source-group, ttl, tos, sourceport, pf

See also: UDP4-DATAGRAM, UDP6-DATAGRAM, UDP-SENDTO, UDP-RECVFROM, UDP-RECV, UDP-CONNECT, UDP-LISTEN, IP-DATAGRAM
另请参阅: 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 (example1, example2).
像 UDP 数据报一样,但仅支持 IPv4 协议(示例 1,示例 2)。

Option groups: FD,SOCKET,IP4, RANGE
选项组:FD,SOCKET,IP4,RANGE

UDP6-DATAGRAM:<address>:<port>
Like UDP-DATAGRAM, but only supports IPv6 protocol.
像 UDP 数据报一样,但仅支持 IPv6 协议。

Option groups: FD,SOCKET,IP6,RANGE
选项组: 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.
等待 UDP/IP 数据包到达 <端口> [UDP 服务],并向发送方“连接”回去。接受的 IP 版本为 4 或使用选项 pf 指定的版本。请注意,由于 UDP 协议的特性,不会建立真正的连接;数据必须先从对等方到达,且无法传输文件结束条件。请注意,打开此地址通常会阻塞,直到客户端连接。

Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6
选项组: FD, SOCKET, LISTEN, CHILD, RANGE, IP4, IP6

Useful options: fork, bind, range, pf
有用的选项:fork、bind、range、pf

See also: UDP, UDP4-LISTEN, UDP6-LISTEN, TCP-LISTEN
另请参阅:UDP、UDP4-LISTEN、UDP6-LISTEN、TCP-LISTEN

UDP4-LISTEN:<port>
Like UDP-LISTEN, but only support IPv4 protocol.
类似于 UDP-LISTEN,但仅支持 IPv4 协议。

Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP4
选项组: FD, SOCKET, LISTEN, CHILD, RANGE, IP4

UDP6-LISTEN:<port>
Like UDP-LISTEN, but only support IPv6 protocol.
类似于 UDP-LISTEN,但仅支持 IPv6 协议。

Option groups: FD,SOCKET,LISTEN,CHILD,RANGE,IP6
选项组: 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.
与指定的对等套接字通信,由<port> [UDP 服务] 在<host> [IP 地址] 上定义,使用基于地址规范、名称解析或选项 pf 的 UDP/IP 版本 4 或 6。它仅向该对等套接字发送数据包并从该对等套接字接收数据包。该地址有效地实现了一个数据报客户端。它与 socat UDP-RECVFROM 和 UDP-RECV 地址对配合良好。

Option groups: FD,SOCKET,IP4,IP6
选项组:FD、SOCKET、IP4、IP6

Useful options: ttl, tos, bind, sourceport, pf
有用的选项:ttl、tos、bind、sourceport、pf

See also: UDP4-SENDTO, UDP6-SENDTO, UDP-RECVFROM, UDP-RECV, UDP-CONNECT, UDP-LISTEN, IP-SENDTO
参见: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.
类似于 UDP-SENDTO,但仅支持 IPv4 协议。

Option groups: FD,SOCKET,IP4
选项组:FD,SOCKET,IP4

UDP6-SENDTO:<host>:<port>
Like UDP-SENDTO, but only supports IPv6 protocol.
类似于 UDP-SENDTO,但仅支持 IPv6 协议。

Option groups: FD,SOCKET,IP6
选项组: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.
使用 UDP/IP 版本 4 或 6(取决于选项 pf)在<port> [UDP 服务]上创建一个 UDP 套接字。它从未指定的对等方接收一个数据包,并可能向该对等方发送一个或多个应答数据包。此模式特别适用于每个到达数据包(来自任意对等方)都由自己的子进程处理的 fork 选项。这允许类似于典型基于 UDP 的服务器(如 ntpd 或 named)的行为。此地址与 socat UDP-SENDTO 地址对等方配合良好。

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.
注意: 当第二个地址在进入传输循环之前失败时,数据包将被丢弃。在第二个地址上使用选项 retry 或 forever 以避免数据丢失。

Option groups: FD,SOCKET,IP4,IP6,CHILD,RANGE
选项组: FD, SOCKET, IP4, IP6, CHILD, RANGE

Useful options: fork, ttl, tos, bind, sourceport, pf
有用的选项: 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,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.
类似于 UDP-RECVFROM,但仅支持 IPv4 协议。

Option groups: FD,SOCKET,IP4,CHILD,RANGE
选项组:FD,SOCKET,IP4,CHILD,RANGE

UDP6-RECVFROM:<port>
Like UDP-RECVFROM, but only supports IPv6 protocol.
类似于 UDP-RECVFROM,但仅支持 IPv6 协议。

Option groups: FD,SOCKET,IP6,CHILD,RANGE
选项组: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.
在<port> [UDP 服务]上创建一个 UDP 套接字,根据选项 pf 使用 UDP/IP 版本 4 或 6。它从多个未指定的对等方接收数据包并合并数据。不可能进行回复。它与例如 socat UDP-SENDTO 地址对等方一起工作良好;它的行为类似于 syslog 服务器。

This is a read-only address, see options -u and -U, and dual addresses.
这是一个只读地址,查看选项 -u 和 -U,以及双地址。

Note: if you need the fork option, use UDP-RECVFROM in unidirectional mode (with option -u) instead.
注意: 如果您需要 fork 选项,请改用单向模式下的 UDP-RECVFROM(使用选项 -u)。

Option groups: FD,SOCKET,IP4,IP6,RANGE
选项组: FD, SOCKET, IP4, IP6, RANGE

Useful options: pf, bind, sourceport, ttl, tos
有用的选项: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、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.
类似于 UDP-RECV,但仅支持 IPv4 协议。

Option groups: FD,SOCKET,IP4,RANGE
选项组: FD, SOCKET, IP4, RANGE

UDP6-RECV:<port>
Like UDP-RECV, but only supports IPv6 protocol.
类似于 UDP-RECV,但仅支持 IPv6 协议。

Option groups: FD,SOCKET,IP6,RANGE
选项组: FD, SOCKET, IP6, RANGE

UDPLITE-CONNECT:<host>:<port>

UDPLITE4-CONNECT:<host>:<port>

UDPLITE6-CONNECT:<host>:<port>

UDPLITE-DATAGRAM:<address>:<port>

UDPLITE4-DATAGRAM:<address>:<port>

UDPLITE6-DATAGRAM:<address>:<port>

UDPLITE-LISTEN:<port>

UDPLITE4-LISTEN:<port>

UDPLITE6-LISTEN:<port>

UDPLITE-SENDTO:<host>:<port>

UDPLITE4-SENDTO:<host>:<port>

UDPLITE6-SENDTO:<host>:<port>

UDPLITE-RECVFROM:<port>

UDPLITE4-RECVFROM:<port>

UDPLITE6-RECVFROM:<port>

UDPLITE-RECV:<port>

UDPLITE4-RECV:<port>

UDPLITE6-RECV:<port>
The UDPLITE addresses are almost identical to the related UDP addresses but they use UDP-Lite protocol and have the additional UDPLITE option group.
UDPLITE 地址几乎与相关的 UDP 地址相同,但它们使用 UDP-Lite 协议,并具有额外的 UDPLITE 选项组。

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.
连接到<filename>,假设它是一个 UNIX 域套接字。如果<filename>不存在,则会出错;如果<filename>不是 UNIX 域套接字,则会出错;如果<filename>是 UNIX 域套接字,但没有进程在监听,则会出错。

Option groups: FD,SOCKET,NAMED,RETRY,UNIX
选项组:FD,SOCKET,NAMED,RETRY,UNIX

) Useful options: bind ) 有用的选项: bind
See also: UNIX-LISTEN, UNIX-SENDTO, TCP
另请参阅: 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) (example).
使用 UNIX 域流套接字在 <filename> 上侦听并接受连接。如果 <filename> 存在且不是套接字,则会出错。如果 <filename> 存在且是 UNIX 域套接字,则绑定到该地址会失败(使用选项 unlink-early!)。请注意,通常打开此地址会阻塞,直到客户端连接。从 socat 版本 1.4.3 开始,关闭此地址时会删除文件系统条目(但请参阅选项 unlink-close)(示例)。

Option groups: FD,SOCKET,NAMED,LISTEN,CHILD,RETRY,UNIX
选项组: FD, SOCKET, NAMED, LISTEN, CHILD, RETRY, UNIX

Useful options: fork, umask, mode, user, group, unlink-early
有用的选项: fork, umask, mode, user, group, unlink-early

See also: UNIX-CONNECT, UNIX-RECVFROM, UNIX-RECV, TCP-LISTEN
另请参阅: 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 (e.g. /tmp/sock1, which must not exist before). This address type works well with socat UNIX-RECVFROM and UNIX-RECV address peers.
与指定的对等套接字通信,由 [ ] 定义,假设它是 UNIX 域数据报套接字。它只向该对等套接字发送数据包并从该对等套接字接收数据包。请注意,可能需要将本地套接字绑定到一个地址(例如 /tmp/sock1 ,在此之前不能存在)。此地址类型与 socat UNIX-RECVFROM 和 UNIX-RECV 地址对配合良好。

Option groups: FD,SOCKET,NAMED,UNIX
选项组:FD、SOCKET、NAMED、UNIX

Useful options: bind 有用的选项:bind
See also: UNIX-RECVFROM, UNIX-RECV, UNIX-CONNECT, UDP-SENDTO, IP-SENDTO
参见: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.
创建一个 UNIX 域数据报套接字[<filename>]。接收一个数据包,并可能向对等方发送一个或多个应答数据包。此模式特别适用于具有 fork 选项的情况,其中每个到达的数据包 - 来自任意对等方 - 都由其自己的子进程处理。此地址与 socat UNIX-SENDTO 地址对等方配合良好。

Option groups: FD,SOCKET,NAMED,CHILD,UNIX
选项组:FD,SOCKET,NAMED,CHILD,UNIX

See the note about RECVFROM addresses.
查看有关 RECVFROM 地址的注释。

Useful options: fork 有用的选项:fork
umask
See also: UNIX-SENDTO, UNIX-RECV, UNIX-LISTEN, UDP-RECVFROM, IP-RECVFROM
参见: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, this is a read-only address, see options -u and -U, and dual addresses. It can be, e.g., addressed by socat UNIX-SENDTO address peers. It behaves similar to a syslog server.
创建一个 UNIX 域数据报套接字[<filename>]。从多个未指定的对等方接收数据包并合并数据。无法回复,这是一个只读地址,参见选项-u 和-U,以及双地址。例如,可以通过 socat UNIX-SENDTO 地址对等方来寻址。它的行为类似于 syslog 服务器。

Option groups: FD,SOCKET,NAMED,UNIX
选项组:FD,SOCKET,NAMED,UNIX

Useful options: umask 有用的选项:umask
See also: UNIX-SENDTO, UNIX-RECVFROM, UNIX-LISTEN, UDP-RECV, IP-RECV
另请参阅: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.
与指定的对等套接字通信,由[<filename>]定义,假定它是一个 UNIX 域套接字。它首先尝试连接,如果失败,则假定它是一个数据报套接字,因此支持两种类型。

Option groups: FD,SOCKET,NAMED,UNIX
选项组: FD, SOCKET, NAMED, UNIX

Useful options: bind 有用选项: bind
See also: UNIX-CONNECT, UNIX-SENDTO, GOPEN
另请参阅: UNIX-CONNECT, UNIX-SENDTO, GOPEN

VSOCK-CONNECT:<cid>:<port>
Establishes a VSOCK stream connection to the specified <cid> [VSOCK cid] and <port> [VSOCK port].
建立到指定的 <cid> [VSOCK cid] 和 <port> [VSOCK port] 的 VSOCK 流连接。

Option groups: FD,SOCKET,CHILD,RETRY
选项组: FD, SOCKET, CHILD, RETRY

Useful options: bind, connect-timeout, retry, readbytes
有用的选项: bind, connect-timeout, retry, readbytes

See also: VSOCK-LISTEN,
查看也: VSOCK-LISTEN

VSOCK-LISTEN:<port>
Listens on <port> [VSOCK port] and accepts a VSOCK connection. Note that opening this address usually blocks until a client connects.
在 <端口> [VSOCK 端口] 上监听,并接受 VSOCK 连接。请注意,打开此地址通常会阻塞,直到客户端连接。

Option groups: FD,SOCKET,LISTEN,CHILD,RETRY
选项组: FD, SOCKET, LISTEN, CHILD, RETRY

Useful options: fork, bind, max-children, backlog, su, reuseaddr, retry
有用的选项:fork、bind、max-children、backlog、su、reuseaddr、retry

See also: VSOCK-CONNECT
另请参阅:VSOCK-CONNECT

ABSTRACT-CONNECT:<string>

ABSTRACT-LISTEN:<string>

ABSTRACT-SENDTO:<string>

ABSTRACT-RECVFROM:<string>

ABSTRACT-RECV:<string>

ABSTRACT-CLIENT:<string>
The ABSTRACT addresses are almost identical to the related UNIX addresses except that they do not address file system based sockets but an alternate UNIX domain address space. To achieve this the socket address strings are prefixed with "\0" internally. This feature is available (only?) on Linux. Option groups are the same as with the related UNIX addresses, except that the ABSTRACT addresses are not member of the NAMED group.
抽象地址与相关的 UNIX 地址几乎相同,只是它们不是针对基于文件系统的套接字,而是针对另一个 UNIX 域地址空间。为了实现这一点,套接字地址字符串在内部以 "\0" 为前缀。此功能仅在 Linux 上可用(?)。选项组与相关的 UNIX 地址相同,只是抽象地址不属于 NAMED 组。

Useful options: netns
有用的选项:netns

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 (but see option -g).
由于技术原因,并非每个选项都可以应用于每种地址类型;例如,将套接字选项应用于常规文件将失败。为了在打开阶段尽早捕捉大多数无用的组合,引入了选项组的概念。每个选项属于一个或多个选项组。选项只能与支持其至少一个选项组的地址类型一起使用(但请参见选项 -g)。

Address options have data types that their values must conform to. Every address option consists of just a keyword or a keyword followed by "=value", where value must conform to the options type. Some address options manipulate parameters of system calls; e.g., option sync sets the O_SYNC flag with the open() call. Other options cause a system or library call; e.g., with option `ttl=value' the setsockopt(fd, SOL_IP, IP_TTL, value, sizeof(int)) call is applied. Other options set internal socat variables that are used during data transfer; e.g., `crnl' causes explicit character conversions. A few options have more complex implementations; e.g., su-d (substuser-delayed) inquires some user and group infos, stores them, and applies them later after a possible chroot() call.
地址选项具有其值必须符合的数据类型。每个地址选项仅由关键字或关键字后跟“=值”组成,其中值必须符合选项类型。一些地址选项操作系统调用的参数;例如,选项 sync 使用 O_SYNC 调用设置 open() 标志。其他选项会导致系统或库调用;例如,使用选项 `ttl=value' 会应用 setsockopt(fd, SOL_IP, IP_TTL, value, sizeof(int)) 调用。其他选项设置用于数据传输期间的内部 socat 变量;例如,`crnl' 导致显式字符转换。一些选项具有更复杂的实现;例如,su-d(substuser-delayed)查询一些用户和组信息,存储它们,并在可能的 chroot() 调用后稍后应用它们。

If multiple options are given to an address, their sequence in the address specification has (almost) no effect on the sequence of their execution/application. Instead, socat has built in an option phase model that tries to bring the options in a useful order. Some options exist in different forms (e.g., unlink, unlink-early, unlink-late) to control the time of their execution.
如果一个地址有多个选项,它们在地址规范中的顺序几乎不会影响它们的执行/应用顺序。相反,socat 内置了一个选项阶段模型,试图将选项按照有用的顺序排列。一些选项以不同形式存在(例如,unlink,unlink-early,unlink-late)以控制它们执行的时间。

If the same option is specified more than once within one address specification, with equal or different values, the effect depends on the kind of option. Options resulting in function calls like setsockopt() cause multiple invocations. With options that set parameters for a required call like open() or set internal flags, the value of the last option occurrence is effective.
如果在一个地址规范中多次指定相同的选项,无论值相同还是不同,效果取决于选项的类型。导致函数调用的选项(如 setsockopt() )会导致多次调用。对于设置必需调用参数的选项(如 open() )或设置内部标志的选项,最后一个选项出现的值有效。

The existence or semantics of many options are system dependent. Socat usually does NOT try to emulate missing libc or kernel features, it just provides an interface to the underlying system. So, if an operating system lacks a feature, the related option is simply not available on this platform.
许多选项的存在或语义取决于系统。Socat 通常不会尝试模拟缺失的 libc 或内核功能,它只是提供对底层系统的接口。因此,如果操作系统缺少某个功能,则相关选项在该平台上简单地不可用。

The following paragraphs introduce just the more common address options. For a more comprehensive reference and to find information about canonical option names, alias names, option phases, and platforms see file xio.help.
以下段落仅介绍更常见的地址选项。要获取更全面的参考资料,并查找有关规范选项名称、别名、选项阶段和平台的信息,请参阅文件 xio.help。



FD option group FD 选项组

This option group contains options that are applied to a UN*X 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.
此选项组包含应用于 UNIX 风格文件描述符的选项,无论它是如何生成的。由于所有当前的 socat 地址类型都是基于文件描述符的,这些选项可以应用于任何地址。

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.
注意: 这些选项中的一些也是另一个选项组的成员,该选项组提供另一种非 fd 基础机制。对于这些选项,取决于实际地址类型及其选项组使用哪种机制。第二种非 fd 基础机制被优先使用。

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.
使用 fcntl() 系统调用将 FD_CLOEXEC 标志设置为值。如果设置了该标志,则在 exec() 族函数调用时关闭文件描述符。Socat 在内部处理其控制的 fds 的此标志,因此在大多数情况下不需要应用此选项。

setlk[=<bool>]
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.
尝试使用 fcntl(fd, F_SETLK, ...) 系统调用对整个文件设置自由写锁。如果文件已被锁定,则此调用将导致错误。在 Linux 上,当组的文件权限为"S"(g-x,g+s),并且文件系统在本地挂载时使用"mand"选项时,锁是强制性的,即阻止其他进程打开文件。

setlkw[=<bool>]
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.
尝试使用 fcntl(fd, F_SETLKW, ...) 系统调用将自由等待写锁设置为整个文件。如果文件已被锁定,此调用将被阻塞。有关使此锁定变为强制的信息,请参阅选项 setlk。

setlk-rd[=<bool>]
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.
尝试使用 fcntl(fd, F_SETLK, ...) 系统调用将自由读锁设置为整个文件。如果文件已被写锁定,此调用将导致错误。有关使此锁定变为强制的信息,请参阅选项 setlk。

setlkw-rd[=<bool>]
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.
尝试使用 fcntl(fd, F_SETLKW, ...) 系统调用将自由等待读锁设置为整个文件。如果文件已被写锁定,此调用将被阻塞。有关使此锁定变为强制的信息,请参阅选项 setlk。

flock-ex[=<bool>]
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(fd, LOCK_EX) 系统调用对文件设置阻塞独占性咨询锁。如果文件被另一个进程锁定,Socat 在此调用中会挂起。

flock-ex-nb[=<bool>]
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(fd, LOCK_EX|LOCK_NB) 系统调用对文件设置非阻塞独占性咨询锁。如果文件已被锁定,此选项会导致错误。

flock-sh[=<bool>]
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(fd, LOCK_SH) 系统调用对文件设置阻塞共享咨询锁。如果文件被另一个进程锁定,Socat 在此调用中会挂起。

flock-sh-nb[=<bool>]
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.
尝试使用 flock(fd, LOCK_SH|LOCK_NB) 系统调用对文件设置非阻塞共享咨询锁。如果文件已被锁定,此选项将导致错误。

lock[=<bool>]
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.
对文件设置阻塞锁。根据特定平台上的可用性使用 setlk 或 flock 机制。如果两者都可用,则使用 POSIX 变体(setlkw)。

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.
设置流的 (所有者)。如果地址是 NAMED 选项组的成员,socat 在打开文件或绑定到 UNIX 域套接字后使用 chown() 系统调用(竞争条件!)。没有文件系统条目,socat 使用 fchown() 系统调用设置流的用户。这些调用可能需要 root 权限。

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.
将 fd 的所有者设置为 ,在打开或连接通道后使用 fchown() 系统调用。这仅适用于文件系统条目。

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.
设置流的 。如果地址是 NAMED 选项组的成员,socat 在打开文件或绑定到 UNIX 域套接字后使用 chown() 系统调用(竞争条件!)。没有文件系统条目,socat 使用 fchown() 系统调用设置流的组。这些调用可能需要组成员资格或 root 权限。

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.
将 fd 的组设置为 ,在打开或连接通道后使用 fchown() 系统调用。这仅适用于文件系统条目。

mode=<mode>
Sets the <mode> [mode_t] (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() system call 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.
设置流的 [ mode_t](权限)。如果地址是 NAMED 选项组的成员并使用 open()creat() 调用,则使用这些应用模式。如果地址是 NAMED 选项组的成员,而没有使用这些系统调用,socat 在打开文件系统条目或绑定到 UNIX 域套接字后使用 chmod() 系统调用(竞争条件!)。否则,socat 使用 fchmod() 设置流的模式。这些调用可能需要所有权或根权限。

perm-late=<mode>
Sets the permissions of the fd to value <mode> [mode_t] using the fchmod() system call after opening or connecting the channel. This is useful only on file system entries.
使用 fchmod() 系统调用将 fd 的权限设置为值 [ mode_t],在打开或连接通道后。这仅对文件系统条目有用。

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 (example). Otherwise, socat applies the fcntl(fd, F_SETFL, O_APPEND) call.
始终将数据写入实际文件末尾。如果地址是 OPEN 选项组的成员,socat 使用 O_APPEND 标志与 open() 系统调用(示例)。否则,socat 应用 fcntl(fd, F_SETFL, O_APPEND) 调用。

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() system call. Otherwise, socat applies the fcntl(fd, F_SETFL, O_NONBLOCK) call.
尝试以非阻塞模式打开或使用文件。它的唯一效果是 TCP 地址的调用不会阻塞,并且打开命名管道进行读取不会阻塞。如果地址是 OPEN 选项组的成员,socat 使用 O_NONBLOCK 标志与 open 系统调用。否则,socat 应用 open 调用。

binary[=<bool>]
Opens the file in binary mode to avoid implicit line terminator conversions (Cygwin).
以二进制模式打开文件,以避免隐式换行符转换(Cygwin)。

text[=<bool>]
Opens the file in text mode to force implicit line terminator conversions (Cygwin).
以文本模式打开文件,强制隐式换行符转换(Cygwin)。

noinherit[=<bool>]
Does not keep this file open in a spawned process (Cygwin).
不要在生成的进程(Cygwin)中保持此文件打开。

cool-write[=<bool>]
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. Use this option only with option fork because otherwise it might cause socat to exit with code 0 even on failure.
当写操作失败时,以 EPIPE 或 ECONNRESET 并使用通知级别记录消息,而不是错误级别。 这可以防止在 socat 用作高容量服务器或代理时客户端经常中止连接时,日志文件被填满无用的错误消息。 仅在选项 fork 的情况下使用此选项,否则可能导致 socat 即使失败也以代码 0 退出。

This option is deprecated, consider using option children-shutup instead.
此选项已弃用,请考虑改用选项 children-shutup。

end-close[=<bool>]
Changes the (address dependent) method of ending a connection to just close the file descriptors. This is useful when the connection is to be reused by or shared with other processes (example).
更改(地址相关)结束连接的方法,仅关闭文件描述符。当连接将被其他进程重用或共享时,这是有用的(示例)。

Normally, socket connections will be ended with shutdown(2) which terminates the socket even if it is shared by multiple processes. close(2) "unlinks" the socket from the process but keeps it active as long as there are still links from other processes.
通常,套接字连接将以 shutdown(2) 结束,即使它被多个进程共享也会终止套接字。 close(2) 会将套接字从进程中“取消链接”,但只要其他进程仍有链接,它就会保持活动状态。

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.
类似地,当类型为 EXEC 或 SYSTEM 的地址结束时,socat 通常会显式杀死子进程。使用此选项,它将仅关闭文件描述符。

shut-none[=<bool>]
Changes the (address dependent) method of shutting down the write part of a connection to not do anything.
更改关闭连接写部分的方法(与地址有关),不执行任何操作。

shut-down[=<bool>]
Changes the (address dependent) method of shutting down the write part of a connection to shutdown(fd, SHUT_WR). Is only useful with sockets.
更改关闭连接写部分的方法(与地址有关),使用 shutdown(fd, SHUT_WR)。仅适用于套接字。

shut-close[=<bool>]
Changes the (address dependent) method of shutting down the write part of a connection to close(fd).
更改关闭连接写部分的方法(与地址有关),使用 close(fd)。

shut-null[=<bool>]
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.
当一个地址指示 EOF 时,socat 将向另一个地址的写通道发送一个大小为零的数据包,以传输 EOF 条件。这在 UDP 和其他数据报协议中很有用。已针对 netcat 和 socat 以选项 null-eof 进行了测试。

null-eof[=<bool>]
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 (see shut-null).
通常情况下,socat 会忽略在数据报套接字上到达的空(零大小负载)数据包,因此可以抵御端口扫描。使用此选项,socat 将空数据报数据包解释为 EOF 指示器(参见 shut-null)。

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.
使用请求值作为第二个参数,NULL 作为第三个参数调用 ioctl() 。此选项允许利用在 socat 中未明确实现的 ioctl。

ioctl-int=<request>:<value>
Calls ioctl() with the request value as second argument and the integer value as third argument.
使用请求值作为第二个参数和整数值作为第三个参数调用 ioctl()

ioctl-intp=<request>:<value>
Calls ioctl() with the request value as second argument and a pointer to the integer value as third argument.
使用请求值作为第二个参数和指向整数值的指针作为第三个参数调用 ioctl()

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() 。此数据必须以形式指定。

ioctl-string=<request>:<value>
Calls ioctl() with the request value as second argument and a pointer to the given string as third argument. <dalan> form.
使用请求值作为第二个参数,并将给定字符串的指针作为第三个参数调用 ioctl() 。形式。


NAMED option group NAMED 选项组

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.
请注意,对于 UNIX 域客户端地址,这意味着绑定条目,而不是目标/对等条目。

See also options user, group, and mode.
另请参阅选项用户、组和模式。

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.
在访问文件系统条目之前,使用 chown() 系统调用更改文件的 (所有者)。此调用可能需要 root 权限。

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.
在访问文件系统条目之前,使用 chown() 系统调用更改文件系统条目的。此调用可能需要组成员资格或根特权。

perm-early=<mode>
Changes the <mode> [mode_t] of the file system entry before accessing it, using the chmod() system call. This call might require ownership or root privilege.
在访问文件系统条目之前,使用 chmod() 系统调用更改文件系统条目的 [mode_t]。此调用可能需要所有权或根特权。

unlink-early[=<bool>]
Unlinks (removes) the file before opening it and even before applying user-early etc.
在打开文件之前甚至在应用用户早期等之前取消链接(删除)文件。

unlink[=<bool>]
Unlinks (removes) the file before accessing it, but after user-early etc.
在访问文件之前取消链接(删除)文件,但在用户早期等之后。

unlink-late[=<bool>]
Unlinks (removes) the file after opening it to make it inaccessible for other processes after a short race condition.
在打开文件后取消链接(删除)文件,以使其他进程在短暂的竞争条件后无法访问该文件。

unlink-close[=<bool>]
Controls removal of the addresses file system entry when closing the address. For named pipes, UNIX domain sockets, and the symbolic links of pty addresses, the default is remove (1); for created files, opened files, and generic opened files the default is keep (0). Setting this option to 1 removes the entry, 0 keeps it. No value means 1.
在关闭地址时控制地址文件系统条目的移除。对于命名管道、UNIX 域套接字和 pty 地址的符号链接,默认值为 remove(1);对于创建的文件、已打开的文件和通用已打开的文件,默认值为 keep(0)。将此选项设置为 1 将删除该条目,0 将保留该条目。没有值表示为 1。


OPEN option group 打开选项组

The OPEN group options allow setting flags with the open() system call. E.g., option `creat' sets the O_CREAT flag. When the used address does not use open() (e.g.STDIO), the fcntl(..., F_SETFL, ...) call is used instead.
打开组选项允许使用 open() 系统调用设置标志。例如,选项`creat'设置 O_CREAT 标志。当使用的地址不使用 open() (例如 STDIO)时,将改用 fcntl(..., F_SETFL, ...) 调用。

See also options append and nonblock.
另请参阅选项 append 和 nonblock。

creat[=<bool>]
Creates the file if it does not exist (example).
如果文件不存在,则创建文件(示例)。

dsync[=<bool>]
Blocks write() calls until metainfo is physically written to media.
阻止 write() 调用,直到元信息被物理写入媒体为止。

excl[=<bool>]
With option creat, if file exists this is an error.
使用 creat 选项,如果文件存在,则会报错。

largefile[=<bool>]
On 32 bit systems, allows a file larger than 2^31 bytes.
在 32 位系统上,允许文件大小超过 2^31 字节。

noatime[=<bool>]
Sets the O_NOATIME options, so reads do not change the access timestamp.
设置 O_NOATIME 选项,因此读取不会更改访问时间戳。

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.
阻塞 write() 直到元信息被物理写入媒体。

sync[=<bool>]
Blocks write() until data is physically written to media.
阻塞 write() 直到数据被物理写入媒体。

rdonly[=<bool>]
Opens the file for reading only.
仅打开文件以供读取。

wronly[=<bool>]
Opens the file for writing only.
仅打开文件进行写入。

trunc[=<bool>]
Truncates the file to size 0 during opening it.
在打开文件时将文件截断为大小为 0。


REG and BLK option group
REG 和 BLK 选项组。

These options are usually applied to a UN*X file descriptor, but their semantics make sense only on a file supporting random access.
这些选项通常应用于 UN*X 文件描述符,但它们的语义只在支持随机访问的文件上才有意义。

seek=<offset>
Applies the lseek(fd, <offset>, SEEK_SET) (or lseek64 ) system call, thus positioning the file pointer absolutely to <offset> [off_t or off64_t]. Please note that a missing value defaults to 1, not 0.
应用 lseek(fd, <offset>, SEEK_SET) (或 lseek64 )系统调用,因此将文件指针绝对定位到 [off_t 或 off64_t]。请注意,缺少值默认为 1,而不是 0。

seek-cur=<offset>
Applies the lseek(fd, <offset>, SEEK_CUR) (or lseek64 ) system call, thus positioning the file pointer <offset> [off_t or off64_t] bytes relatively to its current position (which is usually 0). Please note that a missing value defaults to 1, not 0.
应用 lseek(fd, <offset>, SEEK_CUR) (或 lseek64 )系统调用,因此将文件指针 [off_t 或 off64_t] 字节相对于其当前位置(通常为 0)定位。请注意,缺少值默认为 1,而不是 0。

seek-end=<offset>
Applies the lseek(fd, <offset>, SEEK_END) (or lseek64 ) system call, thus positioning the file pointer <offset> [off_t or off64_t] bytes relatively to the files current end. Please note that a missing value defaults to 1, not 0.
应用 lseek(fd, <offset>, SEEK_END) (或 lseek64 )系统调用,从而将文件指针 [ off_t 或 off64_t]字节相对于文件当前末尾定位。请注意,缺少值默认为 1,而不是 0。

ftruncate=<offset>
Applies the ftruncate(fd, <offset>) (or ftruncate64 if available) system call, thus truncating the file at the position <offset> [off_t or off64_t]. Please note that a missing value defaults to 1, not 0.
应用 ftruncate(fd, <offset>) (或 ftruncate64 如果可用)系统调用,从而将文件截断到位置 [ off_t 或 off64_t]。请注意,缺少值默认为 1,而不是 0。

secrm[=<bool>]

unrm[=<bool>]

compr[=<bool>]

fs-sync[=<bool>]

immutable[=<bool>]

fs-append[=<bool>]

nodump[=<bool>]

fs-noatime[=<bool>]

journal-data[=<bool>]

notail[=<bool>]

dirsync[=<bool>]
These options change non standard file attributes on operating systems and file systems that support these features, like Linux with ext2fs and successors, xfs, or reiserfs. See man 1 chattr for information on these options. Please note that there might be a race condition between creating the file and applying these options.
这些选项会更改支持这些功能的操作系统和文件系统上的非标准文件属性,例如具有 ext2fs 和后继版本的 Linux,xfs 或 reiserfs。有关这些选项的信息,请参阅 man 1 chattr。请注意,在创建文件和应用这些选项之间可能存在竞争条件。


PIPE options 管道选项

These options may be applied to pipes (fifos).
这些选项可以应用于管道(先进先出)。

f-setpipe-sz=<int>

setpipe=<int>
Set the number of bytes a pipe can buffer. Where more bytes are written the writing process might block. When more bytes are written in a single write() the writing process blocks and might never recover.
设置管道可以缓冲的字节数。当写入更多字节时,写入进程可能会阻塞。当在单个 write() 中写入更多字节时,写入进程会阻塞,可能永远无法恢复。


General address options 通用地址选项

These options may be applied to all address types. They change some process properties that are restored after opening the address.
这些选项可以应用于所有地址类型。它们会更改一些在打开地址后恢复的进程属性。

chdir=<filename>

cd=<filename>
Changes the working directory. After opening the address the master process changes back to the original working directory. Sub processes inherit the temporary setting.
更改工作目录。打开地址后,主进程会切换回原始工作目录。子进程会继承临时设置。

umask=<mode>
Sets the umask of the process to <mode> [mode_t] before opening the address. Useful when file system entries are created or a shell or program is invoked. Usually the value is specified as octal number.
将进程的 umask 设置为 <mode> [ mode_t],然后再打开地址。在创建文件系统条目或调用 shell 或程序时非常有用。通常该值以八进制数指定。

The processes umask value is inherited by child processes. Note: umask is an inverted value: creating a file with umask=0026 results in permissions 0640.
进程的 umask 值会被子进程继承。注意:umask 是一个反转的值:使用 umask=0026 创建文件会得到权限 0640。


PROCESS option group PROCESS 选项组

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.
此组的选项更改进程属性,而不仅仅影响一个数据通道。对于 EXEC 和 SYSTEM 地址以及带有 fork 选项的 LISTEN 和 CONNECT 类型地址,这些选项适用于子进程,而不是主 socat 进程。

chroot=<directory>
Performs a chroot() operation to <directory> after processing the address (example). This call might require root privilege.
在处理地址(示例)后,对 执行 chroot() 操作。此调用可能需要 root 权限。

chroot-early=<directory>
Performs a chroot() operation to <directory> before opening the address. This call might require root privilege.
在打开地址之前,对 执行 chroot() 操作。此调用可能需要 root 权限。

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.
在处理地址后更改进程的主要<组>。此调用可能需要 root 权限。请注意,此选项不会删除其他与组相关的权限。

setgid-early=<group>
Like setgit but is performed before opening the address.
类似于 setgit,但是在打开地址之前执行。

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.
在处理地址后更改进程的<用户>(所有者)。此调用可能需要 root 权限。请注意,此选项不会删除与组相关的权限。检查选项 su 是否更适合您的需求。

setuid-early=<user>
Like setuid but is performed before opening the address.
类似于 setuid,但是在打开地址之前执行。

su=<user>
Changes the <user> (owner) and groups of the process after processing the address (example). This call might require root privilege.
在处理地址(示例)后更改进程的<user>(所有者)和组。此调用可能需要 root 权限。

su-d=<user>
Short name for substuser-delayed. Changes the <user> (owner) and groups of the process after processing the address (example). The user and his groups are retrieved before a possible chroot() . This call might require root privilege.
substuser-delayed 的简短名称。在处理地址(示例)后更改进程的(所有者)和组。在可能的 chroot() 之前,用户及其组将被检索。此调用可能需要 root 权限。

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.
使进程成为指定进程组<pid_t>的成员。如果未给出值,或者值为 0 或 1,则该进程将成为新进程组的领导者。

setsid
Makes the process the leader of a new session (example).
使进程成为新会话的领导者(示例)。

netns=<net-namespace-name>
Before opening the address it tries to switch to the named network namespace. After opening the address it switches back to the previous namespace. (Example with TCP forwarder, example with virtual network connection.
在打开地址之前,它尝试切换到命名的网络命名空间。打开地址后,它会切换回先前的命名空间。(具有 TCP 转发器的示例,具有虚拟网络连接的示例。

Only on Linux; requires root; use option --experimental.
仅适用于 Linux;需要 root 权限;使用选项 --experimental


READLINE option group READLINE 选项组

These options apply to the readline address type.
这些选项适用于 readline 地址类型。

history=<filename>
Reads and writes history from/to <filename> (example).
从/写入历史记录到 <文件名>(示例)。

noprompt
Since version 1.4.0, socat per default tries to determine a prompt - that is then passed to the readline call - by remembering the last incomplete line of the output. With this option, socat does not pass a prompt to readline, so it begins line editing in the first column of the terminal.
从版本 1.4.0 开始,默认情况下,socat 尝试确定一个提示 - 然后将其传递给 readline 调用 - 通过记住输出的最后一个不完整行。使用此选项,socat 不会将提示传递给 readline,因此它将在终端的第一列开始行编辑。

noecho=<pattern>
Specifies a regular pattern for a prompt that prevents the following input line from being displayed on the screen and from being added to the history. The prompt is defined as the text that was output to the readline address after the lastest newline character and before an input character was typed. The pattern is a regular expression, e.g. "^[Pp]assword:.*$" or "([Uu]ser:|[Pp]assword:)". See regex(7) for details. (example)
为提示指定一个常规模式,防止以下输入行显示在屏幕上并添加到历史记录中。提示被定义为在最新的换行符之后和输入字符被键入之前的 readline 地址输出的文本。该模式是一个正则表达式,例如"^[Pp]assword:.*$"或"([Uu]ser:|[Pp]assword:)"。有关详细信息,请参阅 regex(7)。(示例)

prompt=<string>
Passes the string as prompt to the readline function. readline prints this prompt when stepping through the history. If this string matches a constant prompt issued by an interactive program on the other socat address, consistent look and feel can be achieved.
将字符串作为提示传递给 readline 函数。readline 在浏览历史记录时打印此提示。如果此字符串与另一个 socat 地址上由交互式程序发出的常量提示匹配,则可以实现一致的外观和感觉。


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.
此组包含在数据级别起作用的选项。请注意,这些选项仅适用于 socat 传输的“原始”数据,而不适用于 PROXY 等地址使用的协议数据。

cr
Converts the default line termination character NL ('\n', 0x0a) to/from CR ('\r', 0x0d) when writing/reading on this channel.
将默认的换行符 NL('\n',0x0a)在此通道上写入/读取时转换为/从 CR('\r',0x0d)。

crnl
Converts the default line termination character NL ('\n', 0x0a) to/from CRNL ("\r\n", 0x0d0a) when writing/reading on this channel (example). Note: socat simply strips all CR characters.
将默认的换行符 NL('\n',0x0a)在此通道上写入/读取时转换为/从 CRNL("\r\n",0x0d0a)(示例)。注意:socat 简单地剥离所有 CR 字符。

ignoreeof
When EOF occurs on this channel, socat ignores it and tries to read more data (like "tail -f") (example).
当此通道发生 EOF 时,socat 会忽略它并尝试读取更多数据(类似于 "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.
socat 仅从此地址读取了这么多字节(该地址仅提供了这么多字节用于传输,并在之后假装已到达文件结尾)。必须大于 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 (example).
指定触发输入流 EOF 的字符的数字代码。在原始模式下的终端中很有用(示例)。


SOCKET option group SOCKET 选项组

These options are intended for all kinds of sockets, e.g. IP or UNIX domain. Most are applied with a setsockopt() call.
这些选项适用于各种类型的套接字,例如 IP 或 UNIX 域。大多数与 setsockopt() 调用一起使用。

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)] (example), VSOCK allows the form [cid][:(port)].
使用 bind() 系统调用将套接字绑定到给定的套接字地址。 的形式取决于套接字域:IP4 和 IP6 允许形式[主机名|主机地址][:(服务|端口)](示例),VSOCK 允许形式[cid][:(端口)]。

See also: unix-bind-tempname
另请参阅:unix-bind-tempname

connect-timeout=<seconds>
Abort the connection attempt after <seconds> [timeval] with error status.
在<seconds> [timeval]后以错误状态中止连接尝试。

so-bindtodevice=<interface>
Binds the socket to the given <interface>. This option might require root privilege.
将套接字绑定到给定的<interface>。此选项可能需要 root 权限。

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 [int] expired.
在数据传输完成或给定超时 [int] 到期之前,阻止 shutdown()close()

oobinline
Places out-of-band data in the input data stream.
将带外数据放入输入数据流中。

priority=<priority>
Sets the protocol defined <priority> [<int>] for outgoing packets.
为传出数据包设置协议定义的<priority> [<int>]。

rcvbuf=<bytes>
Sets the size of the receive buffer after the socket() call to <bytes> [int]. With TCP sockets, this value corresponds to the socket's maximal window size.
socket() 调用后设置接收缓冲区的大小为 [int]。对于 TCP 套接字,此值对应于套接字的最大窗口大小。

rcvbuf-late=<bytes>
Sets the size of the receive buffer when the socket is already connected to <bytes> [int]. With TCP sockets, this value corresponds to the socket's maximal window size.
设置套接字已连接到 <bytes> [int] 时的接收缓冲区大小。对于 TCP 套接字,此值对应于套接字的最大窗口大小。

so-rcvtimeo=<time>, rcvtimeo=<time>
Specifies the time [int] until recv() , read() etc. functions timeout when no data is received. Note that in the transfer phase socat only calls these functions when select() has reported that data is available. However this option is useful with DTLS addresses to timeout during connection negotiation.
指定在未收到数据时, recv()read() 等函数超时的时间 [int]。请注意,在传输阶段,socat 仅在 select() 报告数据可用时调用这些函数。但是,此选项在 DTLS 地址上用于在连接协商期间设置超时。

so-sndtimeo=<time>, sndtimeo=<time>
Like so-recvtimeo, but for send . Not usecase known.
类似于 so-recvtimeo,但用于 send 。未知用例。

rcvlowat=<bytes>
Specifies the minimum number of received bytes [int] until the socket layer will pass the buffered data to socat.
指定接收的字节数[ int]的最小数量,直到套接字层将缓冲数据传递给 socat。

reuseaddr[=[0|1]]
Allows other sockets to bind to an address even if parts of it (e.g. the local port) are already in use by socat.
即使 socat 已经使用了地址的部分(例如本地端口),也允许其他套接字绑定到该地址。

With version 1.8.0, this socket option is set automatically for TCP LISTEN addresses. If you prefer the system default (no related setsockopt(...SO_REUSEADDR...) call at all), use form reuseaddr=.
从版本 1.8.0 开始,对于 TCP LISTEN 地址,此套接字选项将自动设置。如果您更喜欢系统默认值(根本没有相关的 setsockopt(...SO_REUSEADDR...) 调用),请使用形式 reuseaddr=

(example).  (示例).

sndbuf=<bytes>
Sets the size of the send buffer after the socket() call to <bytes> [int].
socket() 调用后设置发送缓冲区的大小为 <字节> [整数].

sndbuf-late=<bytes>
Sets the size of the send buffer when the socket is connected to <bytes> [int].
当套接字连接到 <字节> [整数] 时设置发送缓冲区的大小。

sndlowat=<bytes>
Specifies the minimum number of bytes in the send buffer until the socket layer will send the data to <bytes> [int].
指定发送缓冲区中的最小字节数,直到套接字层将数据发送到 <bytes> [ int]。

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.
强制使用指定的 IP 版本或协议。 可以是类似 "ip4" 或 "ip6" 的内容。生成的值将作为 socket()socketpair() 调用的第一个参数。此选项会影响地址解析以及 bind 和 range 选项的所需语法。

socktype=<type>
Sets the type of the socket, specified as second argument to the socket() or socketpair() calls, to <type> [int]. Address resolution is not affected by this option. Under Linux, 1 means stream oriented socket, 2 means datagram socket, 3 means raw socket, and 5 seqpacket (stream keeping packet boundaries). Datagrams are useful when you want to keep packet boundaries.
将套接字的类型设置为 [ int],作为 socket()socketpair() 调用的第二个参数。此选项不会影响地址解析。在 Linux 下,1 表示面向流的套接字,2 表示数据报套接字,3 表示原始套接字,5 表示 seqpacket(保持数据包边界的流)。当您想要保持数据包边界时,数据报非常有用。

protocol
Sets the protocol of the socket, specified as third argument to the socket() or socketpair() calls, to <protocol> [int]. Address resolution is not affected by this option. 6 means TCP, 17 means UDP.
设置套接字的协议,作为第三个参数传递给 socket()socketpair() 调用,设置为 [ int]。此选项不会影响地址解析。6 表示 TCP,17 表示 UDP。

reuseport
Set the SO_REUSEPORT socket option.
设置 SO_REUSEPORT 套接字选项。

so-timestamp
Sets the SO_TIMESTAMP socket option. This enables receiving and logging of timestamp ancillary messages.
设置 SO_TIMESTAMP 套接字选项。这将启用接收和记录时间戳辅助消息。

setsockopt=<level>:<optname>:<optval>
Invokes setsockopt() for the socket with the given parameters. level [int] 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 [int] 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 [dalan] specifies an arbitrary sequence of bytes that are passed to the function per pointer, with the automatically derived length parameter.
使用给定参数为套接字调用 setsockopt() 。第二个参数使用[int]作为 setsockopt() 的参数,并指定层,例如,对于 TCP(Linux 上的 6),或对于套接字层(Linux 上的 1)。[int]是 setsockopt() 的第三个参数,并告诉要设置哪个套接字选项。对于实际数字,您可能需要查找系统的适当包含文件。对于第 4 和第 5 个 setsockopt() 参数, value [dalan]指定通过指针传递给函数的任意字节序列,带有自动派生的长度参数。

setsockopt-int=<level>:<optname>:<optval>
Like setsockopt, but <optval> is a pointer to int [int]
类似于 setsockopt ,但是指向 int 的指针[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 ,但对于监听类型地址,它应用于监听套接字而不是连接的套接字。

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.
setsockopt 一样,但 是一个字符串。这个字符串带有尾随的空字符,并且长度参数会自动从数据中派生。


UNIX option group UNIX 选项组

These options apply to UNIX domain based addresses.
这些选项适用于基于 UNIX 域的地址。

bind-tempname[=/tmp/pre-XXXXXX], unix-bind-tempname[=/tmp/pre-XXXXXX]
Binds to a random path or random address (on abstract namespace sockets). This is useful with datagram client addresses (SENDTO, or CLIENT) that are opened in child processes forked off from a common parent process where the child processes cannot have different bind options. In the path X 's get replaced with a random character sequence similar to tempnam(3). When no argument is given socat takes a default like /tmp/fileXXXXXX .
绑定到随机路径或随机地址(在抽象命名空间套接字上)。这对于在从共同父进程分叉出的子进程中打开的数据报客户端地址( SENDTO ,或 CLIENT )非常有用,其中子进程无法具有不同的绑定选项。在路径 X 中,'s 会被替换为类似于 tempnam(3)的随机字符序列。当没有给出参数时,socat 会采用默认值,类似于 /tmp/fileXXXXXX

unix-tightsocklen[=(0|1)]
On socket operations, pass a socket address length that does not include the whole struct sockaddr_un record but (besides other components) only the relevant part of the filename or abstract string. Default is 1.
在套接字操作中,传递一个套接字地址长度,不包括整个 struct sockaddr_un 记录,而只包括文件名或抽象字符串的相关部分(除其他组件外)。默认值为 1。

IP4 and IP6 option groups
IP4 和 IP6 选项组

These options can be used with IPv4 and IPv6 based sockets.
这些选项可用于基于 IPv4 和 IPv6 的套接字。

tos=<tos>
Sets the TOS (type of service) field of outgoing packets to <tos> [byte] (see RFC 791).
将传出数据包的 TOS(服务类型)字段设置为 <tos> [字节](请参阅 RFC 791)。

ttl=<ttl>
Sets the TTL (time to live) field of outgoing packets to <ttl> [byte].
将传出数据包的 TTL(生存时间)字段设置为 <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 选项,如源路由。必须以二进制形式给出,推荐的格式是一个前导“x”后跟偶数个十六进制数字。此选项可以多次使用,数据将被追加。例如,要通过某个网关连接到主机 10.0.0.1 并使用宽松源路由,可以将网关用作地址参数,并使用选项 ip-options=x8307040a000001 设置宽松源路由。

IP options are defined in RFC 791.
IP 选项在 RFC 791 中定义。

mtudiscover=<0|1|2>
Takes 0, 1, 2 to never, want, or always use path MTU discover on this socket.
采用 0、1、2 分别表示在此套接字上从不、希望或始终使用路径 MTU 发现。

ip-pktinfo
Sets the IP_PKTINFO socket option. This enables receiving and logging of ancillary messages containing destination address and interface (Linux) (example).
设置 IP_PKTINFO 套接字选项。这将启用接收和记录包含目标地址和接口的辅助消息(Linux)(示例)。

ip-recverr
Sets the IP_RECVERR socket option. This enables receiving and logging of ancillary messages containing detailed error information.
设置 IP_RECVERR 套接字选项。这将启用接收和记录包含详细错误信息的辅助消息。

ip-recvopts
Sets the IP_RECVOPTS socket option. This enables receiving and logging of IP options ancillary messages (Linux, *BSD).
设置 IP_RECVOPTS 套接字选项。这将启用接收和记录 IP 选项辅助消息(Linux,*BSD)。

ip-recvtos
Sets the IP_RECVTOS socket option. This enables receiving and logging of TOS (type of service) ancillary messages (Linux).
设置 IP_RECVTOS 套接字选项。这将启用接收和记录 TOS(服务类型)辅助消息(Linux)。

ip-recvttl
Sets the IP_RECVTTL socket option. This enables receiving and logging of TTL (time to live) ancillary messages (Linux, *BSD).
设置 IP_RECVTTL 套接字选项。这将启用接收和记录 TTL(生存时间)辅助消息(Linux,*BSD)。

ip-recvdstaddr
Sets the IP_RECVDSTADDR socket option. This enables receiving and logging of ancillary messages containing destination address (*BSD) (example).
设置 IP_RECVDSTADDR 套接字选项。这将启用接收和记录包含目标地址的辅助消息(*BSD)(示例)。

ip-recvif
Sets the IP_RECVIF socket option. This enables receiving and logging of interface ancillary messages (*BSD) (example).
设置 IP_RECVIF 套接字选项。这将启用接收和记录接口辅助消息(*BSD)(示例)。

ip-add-membership=<multicast-address:interface-address>

ip-add-membership=<multicast-address:interface-name>

ip-add-membership=<multicast-address:interface-index>

ip-add-membership=<multicast-address:interface-address:interface-name>

ip-add-membership=<multicast-address:interface-address:interface-index>
Makes the socket member of the specified multicast group. This only works for IPv4, see ipv6-join-group for the IPv6 variant. The option takes the IP address of the multicast group and info about the desired network interface. The most common syntax is the first one, while the others are only available on systems that provide struct mreqn (Linux).
使套接字成为指定组播组的成员。这仅适用于 IPv4,请参阅 ipv6-join-group 以获取 IPv6 变体。该选项接受组播组的 IP 地址和有关所需网络接口的信息。最常见的语法是第一个,而其他语法仅适用于提供 struct mreqn (Linux)的系统。

The indices of active network interfaces can be shown using the utility procan.
可以使用实用程序 procan 显示活动网络接口的索引。

ip-add-source-membership=<multicast-address:interface-address:source-address>
Makes the socket member of the specified multicast group for the specified source, i.e. only multicast traffic from this address is to be delivered. This only works for IPv4, see ipv6-join-source-group for the IPv6 variant. The option takes the IP address of the multicast group, the IP address of the desired network interface and the source IP address of the multicast traffic.
使套接字成为指定源的指定多播组的成员,即只传递来自此地址的多播流量。这仅适用于 IPv4,有关 IPv6 变体,请参阅 ipv6-join-source-group。该选项接受多播组的 IP 地址,所需网络接口的 IP 地址以及多播流量的源 IP 地址。

ipv6-join-group=<multicast-address:interface-name>

ipv6-join-group=<multicast-address:interface-index>
Makes the socket member of the specified multicast group. This only works for IPv6, see ip-add-membership for the IPv4 variant. The option takes the IP address of the multicast group and info about the desired network interface. The indices of active network interfaces can be shown using the utility procan.
使套接字成为指定多播组的成员。这仅适用于 IPv6,有关 IPv4 变体,请参阅 ip-add-membership。该选项接受多播组的 IP 地址和有关所需网络接口的信息。可以使用实用程序 procan 显示活动网络接口的索引。

ipv6-join-source-group=<multicast-address:interface-name:source-address>

ipv6-join-source-group=<multicast-address:interface-index:source-address>
Makes the socket member of the specified multicast group for the specified source, i.e. only multicast traffic from this address is to be delivered. This only works for IPv6, see ip-add-source-membership for the IPv4 variant. The option takes the IP address of the multicast group, info about the desired network interface and the source IP address of the multicast traffic. The indices of active network interfaces can be shown using the utility procan.
使套接字成为指定源的指定多播组的成员,即只传递来自此地址的多播流量。这仅适用于 IPv6,有关 IPv4 变体,请参阅 ip-add-source-membership。该选项接受多播组的 IP 地址,有关所需网络接口的信息以及多播流量的源 IP 地址。可以使用实用程序 procan 显示活动网络接口的索引。

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.
设置用于出站多播流量的 TTL。默认值为 1。

ip-transparent
Sets the IP_TRANSPARENT socket option. This option might require root privilege.
设置 IP_TRANSPARENT 套接字选项。此选项可能需要 root 权限。


Resolver options 解析器选项

These options temporarily change the behaviour of hostname resolution. The options of form ai-* affect behaviour of the getaddrinfo() function that includes /etc/hosts and NIS based lookups.
这些选项暂时更改主机名解析的行为。形式为 ai-* 的选项会影响包括 /etc/hosts 和基于 NIS 的查找在内的 getaddrinfo() 函数的行为。

The addresses of form res-* only affect DNS lookups, and only when the result is not cached in nscd . These options might not work on all operating systems or libc implementations.
仅当结果未缓存在 nscd 中时, res-* 表单的地址才会影响 DNS 查找。这些选项可能在所有操作系统或 libc 实现上都无法正常工作。

ai-addrconfig[=0|1]

addrconfig[=0|1]
Sets or unsets the AI_ADDRCONFIG flag to prevent name resolution to address families that are not available on the computer (e.g. IPv6). Default value is 1 in case the resolver does not get an address family hint from Socat address or defaults.
设置或取消 AI_ADDRCONFIG 标志,以防止名称解析到计算机上不可用的地址族(例如 IPv6)。默认值为 1,以防解析器未从 Socat 地址或默认值获取地址族提示。

ai-passive[=0|1]

passive[=0|1]
Sets of unsets the AI_PASSIVE flag for getaddrinfo() calls. Default is 1 for LISTEN, RECV, and RECVFROM type addresses, and with bind option.
getaddrinfo() 调用设置或取消 AI_PASSIVE 标志。对于 LISTEN、RECV 和 RECVFROM 类型地址以及带有 bind 选项,默认值为 1。

ai-v4mapped[=0|1]

v4mapped[=0|1]
Sets or unsets the AI_V4MAPPED flag for getaddrinfo() . With socat addresses requiring IPv6 addresses, this resolves IPv4 addresses to the approriate IPv6 address [::ffff:*:*]. For IPv6 Socat addresses, the default is 1.
设置或取消 getaddrinfo() 的 AI_V4MAPPED 标志。对于需要 IPv6 地址的 socat 地址,这将将 IPv4 地址解析为适当的 IPv6 地址 [::ffff:*:*]。对于 IPv6 Socat 地址,默认值为 1。

res-debug

res-aaonly

res-usevc

res-primary

res-igntc

res-recurse

res-defnames

res-stayopen

res-dnsrch
These options set the corresponding resolver (name resolution) option flags. Append "=0" to clear a default option. See man resolver(5) for more information on these options. Socat restores the old values after finishing the open phase of the address, so these options are valid just for the address they are applied to.
这些选项设置相应的解析器(名称解析)选项标志。附加“=0”以清除默认选项。有关这些选项的更多信息,请参阅 man resolver(5)。Socat 在地址的打开阶段完成后恢复旧值,因此这些选项仅对其应用的地址有效。

Please note that these flags only affect DNS resolution, but not hosts or NIS based name resolution, and they have no effect when (g)libc retrieves the results from nscd .
请注意,这些标志仅影响 DNS 解析,但不影响基于主机或 NIS 的名称解析,并且在 (g)libc 从 nscd 检索结果时不起作用。

res-retrans=<int>
Sets the retransmission time interval of the DNS resolver (based on an undocumented feature).
设置 DNS 解析器的重传时间间隔(基于一个未记录的特性)。

res-retry=<int>
Sets the number of retransmits of the DNS resolver (based on an undocumented feature).
设置 DNS 解析器的重传次数(基于一个未记录的特性)。

res-nsaddr=<ipaddr>[:<port>]
Tries to overwrite nameserver settings loaded from /etc/resolv.conf by writing the given IPv4 address into the undocumented _res:nsaddr_list[0] field. /etc/hosts is still checked by resolver. Please note that glibc's nscd is always queried first when it is running!
尝试通过将给定的 IPv4 地址写入未记录的 _res:nsaddr_list[0] 字段,覆盖从 /etc/resolv.conf 加载的域名服务器设置。解析器仍会检查 /etc/hosts 。请注意,当 glibc 运行时,始终首先查询 glibc 的 nscd


IP6 option group IP6 选项组

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.
这些选项只能用于基于 IPv6 的套接字。有关可应用于 IPv4 和 IPv6 套接字的选项,请参阅 IP 选项。

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_V6ONLY 套接字选项。如果为 0,则 TCP 栈还将接受在相同端口上使用 IPv4 协议的连接。默认值取决于系统。

ipv6-recvdstopts
Sets the IPV6_RECVDSTOPTS socket option. This enables receiving and logging of ancillary messages containing the destination options.
设置 IPV6_RECVDSTOPTS 套接字选项。这将启用接收和记录包含目标选项的辅助消息。

ipv6-recvhoplimit
Sets the IPV6_RECVHOPLIMIT socket option. This enables receiving and logging of ancillary messages containing the hoplimit.
设置 IPV6_RECVHOPLIMIT 套接字选项。这将启用接收和记录包含跳数限制的辅助消息。

ipv6-recvhopopts
Sets the IPV6_RECVHOPOPTS socket option. This enables receiving and logging of ancillary messages containing the hop options.
设置 IPV6_RECVHOPOPTS 套接字选项。这将启用接收和记录包含跳数选项的辅助消息。

ipv6-recvpktinfo
Sets the IPV6_RECVPKTINFO socket option. This enables receiving and logging of ancillary messages containing destination address and interface.
设置 IPV6_RECVPKTINFO 套接字选项。这将启用接收和记录包含目标地址和接口的辅助消息。

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_UNICAST_HOPS 套接字选项。这为传出单播数据包设置了跳数限制(TTL)。

ipv6-recvrthdr
Sets the IPV6_RECVRTHDR socket option. This enables receiving and logging of ancillary messages containing routing information.
设置 IPV6_RECVRTHDR 套接字选项。这将启用接收和记录包含路由信息的辅助消息。

ipv6-tclass
Sets the IPV6_TCLASS socket option. This sets the transfer class of outgoing packets.
设置 IPV6_TCLASS 套接字选项。这将设置传出数据包的传输类。

ipv6-recvtclass
Sets the IPV6_RECVTCLASS socket option. This enables receiving and logging of ancillary messages containing the transfer class.
设置 IPV6_RECVTCLASS 套接字选项。这将启用接收和记录包含传输类的辅助消息。


TCP option group TCP 选项组

These options may be applied to TCP sockets. They work by invoking setsockopt() with the appropriate parameters.
这些选项可以应用于 TCP 套接字。它们通过使用适当的参数调用 setsockopt() 来工作。

cork
Doesn't send packets smaller than MSS (maximal segment size).
不发送小于 MSS(最大分段大小)的数据包。

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> [int].
设置在关闭套接字之前保持的保持活动次数为 <count> [整数]。

keepidle=<seconds>
Sets the idle time before sending the first keepalive to <seconds> [int].
设置在发送第一个保持活动之前的空闲时间为 <秒> [整数]。

keepintvl=<seconds>
Sets the interval between two keepalives to <seconds> [int].
设置两个保持活动之间的间隔为 <秒> [整数]。

linger2=<seconds>
Sets the time to keep the socket in FIN-WAIT-2 state to <seconds> [int].
将套接字保持在 FIN-WAIT-2 状态的时间设置为<秒> [int]。

mss=<bytes>
Sets the MSS (maximum segment size) after the socket() call to <bytes> [int]. This value is then proposed to the peer with the SYN or SYN/ACK packet (example).
socket() 调用后将 MSS(最大分段大小)设置为<字节> [int]。然后将此值与 SYN 或 SYN/ACK 数据包一起提议给对等方(示例)。

mss-late=<bytes>
Sets the MSS of the socket after connection has been established to <bytes> [int].
在建立连接后将套接字的 MSS 设置为<字节> [int]。

nodelay
Turns off the Nagle algorithm for measuring the RTT (round trip time).
关闭 Nagle 算法,用于测量往返时间(RTT)。

rfc1323
Enables RFC1323 TCP options: TCP window scale, round-trip time measurement (RTTM), and protect against wrapped sequence numbers (PAWS) (AIX).
启用 RFC1323 TCP 选项:TCP 窗口缩放,往返时间测量(RTTM),并保护免受包装序列号(PAWS)的影响(AIX)。

stdurg
Enables RFC1122 compliant urgent pointer handling (AIX).
启用符合 RFC1122 的紧急指针处理(AIX)。

syncnt=<count>
Sets the maximal number of SYN retransmits during connect to <count> [int].
设置在连接到 <count> [ int] 时 SYN 重传的最大次数。

md5sig
Enables generation of MD5 digests on the packets (FreeBSD).
启用在数据包上生成 MD5 摘要(FreeBSD)。

noopt
Disables use of TCP options (FreeBSD, MacOSX).
禁用 TCP 选项的使用(FreeBSD,MacOSX)。

nopush
sets the TCP_NOPUSH socket option (FreeBSD, MacOSX).
设置 TCP_NOPUSH 套接字选项(FreeBSD,MacOSX)。

sack-disable
Disables use the selective acknowledge feature (OpenBSD).
禁用使用选择性确认功能(OpenBSD)。

signature-enable
Enables generation of MD5 digests on the packets (OpenBSD).
启用在数据包上生成 MD5 摘要(OpenBSD)。

abort-threshold=<milliseconds>
Sets the time to wait for an answer of the peer on an established connection (HP-UX).
设置在已建立连接时等待对等方答复的时间(HP-UX)。

conn-abort-threshold=<milliseconds>
Sets the time to wait for an answer of the server during the initial connect (HP-UX).
设置在初始连接期间等待服务器答复的时间(HP-UX)。

keepinit
Sets the time to wait for an answer of the server during connect() before giving up. Value in half seconds, default is 150 (75s) (Tru64).
在调用 connect()之前设置等待服务器答复的时间。值以半秒为单位,默认值为 150(75 秒)(Tru64)。

paws
Enables the "protect against wrapped sequence numbers" feature (Tru64).
启用“保护包装序列号”功能(Tru64)。

sackena
Enables selective acknowledge (Tru64).
启用选择性确认(Tru64)。

tsoptena
Enables the time stamp option that allows RTT recalculation on existing connections (Tru64).
启用时间戳选项,允许在现有连接上重新计算 RTT(Tru64)。


UDP option group UDP 选项组

This option may be applied to UDP datagram sockets.
此选项可应用于 UDP 数据报套接字。

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-DATAGRAM 期望传入响应来自其第二个参数中指定的端口。使用此选项,它接受来自任何端口的数据包。


UDPLITE option group UDPLITE 选项组

These options may be applied to UDPLITE addresses:
这些选项可以应用于 UDPLITE 地址:

udplite-send-cscov
Sets the number of bytes for which the checksum is calculated and sent ("checksum coverage").
设置计算和发送校验和的字节数(“校验和覆盖范围”)。

udplite-recv-cscov
Sets the number of bytes for which the checksum is checked ("checksum coverage").
设置检查校验和的字节数(“校验和覆盖范围”)。


SCTP option group SCTP 选项组

These options may be applied to SCTP stream sockets.
这些选项可以应用于 SCTP 流套接字。

sctp-nodelay
Sets the SCTP_NODELAY socket option that disables the Nagle algorithm.
设置禁用 Nagle 算法的 SCTP_NODELAY 套接字选项。

sctp-maxseg=<bytes>
Sets the SCTP_MAXSEG socket option to <bytes> [int]. This value is then proposed to the peer with the SYN or SYN/ACK packet.
将 SCTP_MAXSEG 套接字选项设置为 <bytes> [int]。然后将此值与 SYN 或 SYN/ACK 数据包一起提议给对等方。


DCCP option group DCCP 选项组

These options may be applied to DCCP sockets.
这些选项可以应用于 DCCP 套接字。

dccp-set-ccid=<int>

ccid=<int>
Selects the desired congestion control mechanism (CCID).
选择所需的拥塞控制机制(CCID)。


UDP, TCP, SCTP, DCCP, and UDPLITE option group
UDP、TCP、SCTP、DCCP 和 UDPLITE 选项组。

Here we find options that are related to the network port mechanism and thus can be used with UDP, TCP, SCTP, DCCP, and UDP-Lite client and server addresses.
在这里,我们找到与网络端口机制相关的选项,因此可以与 UDP、TCP、SCTP、DCCP 和 UDP-Lite 客户端和服务器地址一起使用。

sourceport=<port>
For outgoing (client) 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. (example).
对于传出(客户端)连接,它使用额外的 bind() 调用设置源<端口>。对于 TCP 或 UDP 监听地址,如果客户端不使用此源端口,socat 会立即关闭连接。UDP-RECV、UDP-RECVFROM、UDP-SENDTO 和 UDP-DATAGRAM 地址在不匹配时会忽略数据包。(示例)。

lowport
Outgoing (client) 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.
具有此选项的传出(客户端)连接使用 640 到 1023 之间的未使用随机源端口。在 UNIX 类操作系统上,这需要 root 权限,因此表明客户端进程由本地 root 授权。具有此选项的 TCP 和 UDP 监听地址会立即关闭连接,如果客户端不使用源端口<= 1023。在某些情况下,此机制可以提供有限的授权。


SOCKS option group SOCKS 选项组

When using SOCKS type addresses, some socks specific options can be set.
当使用 SOCKS 类型地址时,可以设置一些特定于 SOCKS 的选项。

socksport=<tcp service>
Overrides the default "socks" service or port 1080 for the socks server port with <TCP service>.
使用 <TCP 服务> 覆盖默认的 "socks" 服务或端口 1080,用于 socks 服务器端口。

socksuser=<user>
Sends the <user> [string] in the username field to the socks server. Default is the actual user name ($LOGNAME or $USER) (example).
将用户名字段中的<user> [字符串]发送到 socks 服务器。默认为实际用户名($LOGNAME 或$USER)(示例)。


HTTP option group HTTP 选项组

Options that can be provided with HTTP type addresses. The only HTTP address currently implemented is proxy-connect.
可以与 HTTP 类型地址一起提供的选项。目前实现的唯一 HTTP 地址是 proxy-connect。

http-version=<string>
Changes the default "1.0" that is sent to the server in the initial HTTP request. Currently it has not other effect, in particular it does not provide any means to send a Host header.
更改初始 HTTP 请求中发送到服务器的默认“1.0”。目前它没有其他效果,特别是它不提供任何发送主机头的手段。

proxyport=<TCP service>
Overrides the default HTTP proxy port 8080 with <TCP service>.
使用<TCP 服务>覆盖默认的 HTTP 代理端口 8080。

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.
HTTP 协议要求使用 CR+NL 作为行终止符。当代理服务器违反此标准时,socat 可能无法理解其响应。此选项指示 socat 将 NL 解释为行终止符,并忽略响应中的 CR。尽管如此,socat 仍会向代理发送 CR+NL。

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.
为代理服务器提供“基本”身份验证。 选项的参数与以 base64 编码形式的“Proxy-Authorization: Basic”标头一起使用。

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.
注意:用户名和密码对于本地机器上的每个用户在进程列表中是可见的;用户名和密码以未加密(base64 编码)的形式传输到代理服务器,并可能被嗅探。

proxy-authorization-file=<filename>
Like option proxy-authorization, but the credentials are read from the file and therefore not visible in the process list.
类似于选项 proxy-authorization,但凭据是从文件中读取的,因此在进程列表中不可见。

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.
默认情况下,socat 发送包含目标主机名的 CONNECT 请求到代理。使用此选项,socat 在本地解析主机名并发送 IP 地址。请注意,根据 RFC 2396,仅实现了对 IPv4 地址的名称解析。


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.
这些选项检查连接的客户端是否应被授予访问权限。它们可以应用于监听和接收网络套接字。tcp-wrappers 选项属于此组。

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 (example); 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.
在接受连接后,测试对等方是否在范围内。对于 IPv4 地址,address-range 采用 address/bits 的形式,例如 10.0.0.0/8,或 address:mask,例如 10.0.0.0:255.0.0.0(示例);对于 IPv6,它是 [ip6-address]/bits,例如 [::1]/128。如果客户端地址不匹配,socat 拒绝连接尝试,发出警告,并继续监听/接收。

tcpwrap[=<name>]
Uses Wietse Venema's 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 (example). 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.
使用 Wietse Venema 的 libwrap(tcpd)库来确定客户端是否被允许连接。配置文件默认为 /etc/hosts.allow 和 /etc/hosts.deny,请参阅“man 5 hosts_access”获取更多信息。可选的 <name>(类型为字符串)作为守护进程名称传递给包装器函数(示例)。如果省略,则传递 socat 调用的基本名称(argv[0])。如果将 tcpwrap 和 range 选项同时应用于地址,则必须同时满足两个条件才能允许连接。

allow-table=<filename>
Takes the specified file instead of /etc/hosts.allow.
使用指定的文件而不是 /etc/hosts.allow。

deny-table=<filename>
Takes the specified file instead of /etc/hosts.deny.
使用指定的文件而不是 /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.
在指定目录中查找 hosts.allow 和 hosts.deny。被 hosts-allow 和 hosts-deny 选项覆盖。


LISTEN option group LISTEN 选项组

Options specific to listening sockets.
用于监听套接字的特定选项。

backlog=<count>
Sets the backlog value passed with the listen() system call to <count> [int]. Default is 5.
将传递给 listen() 系统调用的 backlog 值设置为 [ int]。默认值为 5。

accept-timeout=<seconds>
End waiting for a connection after <seconds> [timeval] with error status.
在 <seconds> [ timeval] 后以错误状态结束等待连接。


CHILD option group 子选项组

Addresses of LISTEN and CONNECT type take the fork option to handle multiple connections via child processes.
LISTEN 和 CONNECT 类型的地址通过 fork 选项处理多个连接,以通过子进程处理。

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 (example).
在建立连接后,将其通道在子进程中处理,并保持父进程尝试通过循环产生更多连接,无论是通过监听还是连接(示例)。

OPENSSL-CONNECT and OPENSSL-LISTEN differ in when they actually fork off the child: OPENSSL-LISTEN forks before the SSL handshake, while OPENSSL-CONNECT forks afterwards. retry and forever options are not inherited by the child process.
OPENSSL-CONNECT 和 OPENSSL-LISTEN 在实际分叉子进程的时机上有所不同:OPENSSL-LISTEN 在 SSL 握手之前分叉,而 OPENSSL-CONNECT 在 SSL 握手之后分叉。retry 和 forever 选项不会被子进程继承。

On some operating systems (e.g. FreeBSD) this option does not work for UDP-LISTEN addresses.
在某些操作系统上(例如 FreeBSD),此选项对于 UDP-LISTEN 地址不起作用。

max-children=<count>
Limits the number of concurrent child processes [int]. Default is no limit.
限制并发子进程的数量 [ int]。默认情况下没有限制。

children-shutup[=1|2|..]
Decreases the severity of log messages produced by child processes. For example, with value 1 notices are logged as info (or dropped depending on option -dX), and errors are logged as warnings but still cause termination of the child process.
减少子进程产生的日志消息的严重程度。例如,值为 1 时,通知被记录为信息(或根据选项 -dX 被丢弃),错误被记录为警告,但仍会导致子进程终止。

This option is intended to reduce logging of high volume servers or proxies.
此选项旨在减少高容量服务器或代理的日志记录。

This option succeeds option cool-write.
此选项成功地取代了 cool-write 选项。


EXEC option group 执行选项组

Options for addresses that invoke a program.
调用程序的地址选项。

path=<string>
Overrides the PATH environment variable for searching the program with <string>. This $PATH value is effective in the child process too.
用覆盖用于搜索程序的 PATH 环境变量。这个 $PATH 值在子进程中也有效。

login
Prefixes argv[0] for the execvp() call with '-', thus making a shell behave as login shell.
使用'-'为调用添加前缀 argv[0] ,使 shell 表现为登录 shell。


FORK option group FORK 选项组

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.
使用 EXEC 或 SYSTEM 地址调用一个程序,使用子进程在 socat 和程序之间传输数据。可以使用以下选项影响进程间通信机制。默认情况下,会创建一个 socketpair() 并分配给子进程的 stdin 和 stdout,而 stderr 从 socat 进程继承,子进程使用文件描述符 0 和 1 与主 socat 进程通信。

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:
不会为执行程序而分叉一个子进程,而是直接从实际的 socat 实例调用 execvp() 或 system()。这避免了程序和其对等体之间的另一个进程的开销,但引入了许多限制:

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).
使用使用 openpty() 创建的伪终端与子进程建立通信,而不是默认的(socketpair 或 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).
使用通过打开/dev/ptmx 或/dev/ptc 创建的伪终端与子进程建立通信,而不是使用默认的(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 (example).
使用伪终端与子进程建立通信,而不是使用套接字对。使用可用机制创建 pty。如果 openpty 和 ptmx 都可用,则使用 ptmx,因为这是符合 POSIX 标准的(示例)。

ctty
Makes the pty the controlling tty of the sub process (example).
将 pty 设为子进程的控制 tty(示例)。

stderr
Directs stderr of the sub process to its output channel by making stderr a dup() of stdout (example).
将子进程的 stderr 重定向到其输出通道,通过将 stderr 设置为 stdout 的 dup() (示例)。

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 (example).
将子进程的输入通道分配给其文件描述符 <fdnum>,而不是 stdin(0)。从子进程启动的程序必须使用此 fd 从 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 (example).
将子进程的输出通道分配给其文件描述符 <fdnum>,而不是 stdout(1)。从子进程启动的程序必须使用此 fd 将数据写入 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.
将此类型的信号传递给子进程的 socat。如果没有地址具有此选项,则 socat 会在这些信号上终止。


Options for address SHELL
SHELL 地址的选项

shell=<filename>
Overwrites use the default shell with the named executable, e.g. /bin/dash. Also sets the SHELL environment variable.
使用指定的可执行文件(例如 /bin/dash )覆盖默认 shell,并设置 SHELL 环境变量。


TERMIOS option group TERMIOS 选项组

For addresses that work on a tty (e.g., stdio, file:/dev/tty, exec:...,pty), the terminal parameters defined in the UN*X termios mechanism are made available as address option parameters. Please note that changes of the parameters of your interactive terminal remain effective after socat's termination, so you might have to enter "reset" or "stty sane" in your shell afterwards. For EXEC and SYSTEM addresses with option PTY, these options apply to the pty by the child processes.
对于在 tty 上工作的地址(例如 stdio、file:/dev/tty、exec:...、pty),UN*X termios 机制中定义的终端参数作为地址选项参数提供。请注意,交互式终端参数的更改在 socat 终止后仍然有效,因此您可能需要在 shell 中输入 "reset" 或 "stty sane"。对于带有选项 PTY 的 EXEC 和 SYSTEM 地址,这些选项适用于子进程的 pty。

b0
Disconnects the terminal.
断开终端连接。

b19200
Sets the serial line speed to 19200 baud. Some other rates are possible; use something like socat -hh |grep ' b[1-9]' to find all speeds supported by your implementation.
将串行线速度设置为 19200 波特率。还有一些其他速率可用;使用类似 socat -hh |grep ' b[1-9]' 的内容来查找您的实现支持的所有速率。

Note: On some operating systems, these options may not be available. Use ispeed or ospeed instead.
注意:在某些操作系统上,这些选项可能不可用。请改用 ispeed 或 ospeed。

echo[=<bool>]
Enables or disables local echo.
启用或禁用本地回显。

icanon[=<bool>]
Sets or clears canonical mode, enabling line buffering and some special characters.
设置或清除规范模式,启用行缓冲和一些特殊字符。

raw
Sets raw mode, thus passing input and output almost unprocessed. This option is obsolete, use option rawer or cfmakeraw instead.
设置原始模式,因此几乎未经处理地传递输入和输出。此选项已过时,请改用选项 rawer 或 cfmakeraw。

rawer
Makes terminal rawer than raw option. This option implicitly turns off echo. (example).
使终端比原始选项更原始。此选项隐式关闭回显。(示例)。

cfmakeraw
Sets raw mode by invoking cfmakeraw() or by simulating this call. This option implicitly turns off echo.
通过调用 cfmakeraw() 或模拟此调用来设置原始模式。此选项隐式关闭回显。

ignbrk[=<bool>]
Ignores or interpretes the BREAK character (e.g., ^C)
忽略或解释 BREAK 字符(例如,^C)

brkint[=<bool>]

bs0

bs1

bsdly=<0|1>

clocal[=<bool>]

cr0
cr1
cr2
cr3
Sets the carriage return delay to 0, 1, 2, or 3, respectively. 0 means no delay, the other values are terminal dependent.
将回车延迟分别设置为 0、1、2 或 3。 0 表示没有延迟,其他值取决于终端。

crdly=<0|1|2|3>

cread[=<bool>]

crtscts[=<bool>]

cs5
cs6
cs7
cs8
Sets the character size to 5, 6, 7, or 8 bits, respectively.
将字符大小分别设置为 5、6、7 或 8 位。

csize=<0|1|2|3>

cstopb[=<bool>]
Sets two stop bits, rather than one.
设置两个停止位,而不是一个。

dsusp=<byte>
Sets the value for the VDSUSP character that suspends the current foreground process and reactivates the shell (all except Linux).
设置用于挂起当前前台进程并重新激活 shell 的 VDSUSP 字符值(除 Linux 外的所有系统)。

echoctl[=<bool>]
Echos control characters in hat notation (e.g. ^A)
帽符号表示的控制字符(例如 ^A)

echoe[=<bool>]

echok[=<bool>]

echoke[=<bool>]

echonl[=<bool>]

echoprt[=<bool>]

eof=<byte>

eol=<byte>

eol2=<byte>

erase=<byte>

discard=<byte>

ff0

ff1

ffdly[=<bool>]

flusho[=<bool>]

hupcl[=<bool>]

icrnl[=<bool>]

iexten[=<bool>]

igncr[=<bool>]

ignpar[=<bool>]

imaxbel[=<bool>]

inlcr[=<bool>]

inpck[=<bool>]

intr=<byte>

isig[=<bool>]

ispeed=<unsigned-int>
Set the baud rate for incoming data on this line.
设置此行上传入数据的波特率。

See also: ospeed, b19200
参见:ospeed,b19200

istrip[=<bool>]

iuclc[=<bool>]

ixany[=<bool>]

ixoff[=<bool>]

ixon[=<bool>]

kill=<byte>

lnext=<byte>

min=<byte>

nl0
Sets the newline delay to 0.
将换行延迟设置为 0。

nl1

nldly[=<bool>]

noflsh[=<bool>]

ocrnl[=<bool>]

ofdel[=<bool>]

ofill[=<bool>]

olcuc[=<bool>]

onlcr[=<bool>]

onlret[=<bool>]

onocr[=<bool>]

opost[=<bool>]
Enables or disables output processing; e.g., converts NL to CR-NL.
启用或禁用输出处理;例如,将 NL 转换为 CR-NL。

ospeed=<unsigned-int>
Set the baud rate for outgoing data on this line.
设置此行上发送数据的波特率。

See also: ispeed, b19200
参见:ispeed,b19200

parenb[=<bool>]
Enable parity generation on output and parity checking for input.
启用输出的奇偶校验生成和输入的奇偶校验检查。

parmrk[=<bool>]

parodd[=<bool>]

pendin[=<bool>]

quit=<byte>

reprint=<byte>

sane
Brings the terminal to something like a useful default state.
将终端带到类似于有用的默认状态。

start=<byte>

stop=<byte>

susp=<byte>

swtc=<byte>

tab0

tab1

tab2

tab3

tabdly=<unsigned-int>

time=<byte>

tostop[=<bool>]

vt0

vt1

vtdly[=<bool>]

werase=<byte>

xcase[=<bool>]

xtabs

i-pop-all
With UNIX System V STREAMS, removes all drivers from the stack.
使用 UNIX System V STREAMS,从堆栈中移除所有驱动程序。

i-push=<string>
With UNIX System V STREAMS, pushes the driver (module) with the given name (string) onto the stack. For example, to make sure that a character device on Solaris supports termios etc, use the following options: i-pop-all,i-push=ptem,i-push=ldterm,i-push=ttcompat
使用 UNIX System V STREAMS,将具有给定名称(字符串)的驱动程序(模块)推送到堆栈上。例如,要确保 Solaris 上的字符设备支持 termios 等,请使用以下选项: i-pop-all,i-push=ptem,i-push=ldterm,i-push=ttcompat


PTY option group PTY 选项组

These options are intended for use with the pty address type.
这些选项旨在与 pty 地址类型一起使用。

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). Beginning with socat version 1.4.3, the symbolic link is removed when the address is closed (but see option unlink-close).
生成一个指向实际伪终端(pty)的符号链接。这可能有助于解决 pty 以更多或更少不可预测的名称生成的问题,使得难以自动访问由 socat 生成的 pty。通过此选项,用户可以指定文件层次结构中的“固定”点,帮助他访问实际的 pty(示例)。从 socat 版本 1.4.3 开始,当地址关闭时会删除符号链接(但请参阅选项 unlink-close)。

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. This option only works if the operating system provides the poll() system call. And it depends on an undocumented behaviour of pty's, so it does not work on all operating systems. It has successfully been tested on Linux, FreeBSD, NetBSD, and on Tru64 with openpty.
阻止打开阶段,直到进程打开 pty 的从端口。通常,在生成 pty 后,socat 会继续打开下一个地址或进入传输循环。使用 wait-slave 选项,socat 会等到某个进程打开 pty 的从端口后才继续。此选项仅在操作系统提供 poll() 系统调用时有效。它依赖于 pty 的一个未记录的行为,因此不适用于所有操作系统。已在 Linux、FreeBSD、NetBSD 和带有 openpty 的 Tru64 上成功测试过。

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.
当设置 wait-slave 选项时,socat 会定期使用 poll() 检查 HUP 条件,以查找 pty 的从端是否已打开。默认的轮询间隔为 1 秒。使用 pty-interval 选项 [ timeval] 来更改此值。

sitout-eio=<timeval>
The login program in Linux closes its tty/pty and reopens it for security reasons. During this time the pty master would get EIO on I/O operations and might terminate. With this option socat tolerates EIO for the specified time. Please note that in this state socat blocks traffic in both directions, even when it is not related to this channel.
Linux 中的登录程序会出于安全原因关闭其 tty/pty 并重新打开。在此期间,pty 主端可能会在 I/O 操作中收到 EIO 并可能终止。使用此选项,socat 在指定的时间内容忍 EIO。请注意,在此状态下,socat 会阻塞两个方向的流量,即使与此通道无关。


OPENSSL option group OPENSSL 选项组

These options apply to the openssl and openssl-listen address types.
这些选项适用于 openssl 和 openssl-listen 地址类型。

cipher=<cipherlist>
Specifies 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>.
指定可用于连接的密码列表。有关语法、值和的详细信息,请参阅 ciphers 的手册页,CIPHER LIST FORMAT 部分。

Several cipher strings may be given, separated by ':'. Some simple cipher strings:
可以提供多个密码字符串,用 ':' 分隔。一些简单的密码字符串:

3DES
Uses a cipher suite with triple DES.
使用具有三重 DES 的密码套件。

MD5
Uses a cipher suite with MD5.
使用具有 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.
请注意,对等方必须支持所选属性,否则协商将失败。

method=<ssl-method>
This option is based on deprecated functions and is only available when socat was build with option --with-openssl-method. Use option min-proto-version and maybe max-proto-version instead. Sets the protocol version to be used. Valid strings (not case sensitive) are:
此选项基于已弃用的函数,并且仅在 socat 使用选项 --with-openssl-method 构建时才可用。请改用选项 min-proto-version 和可能的 max-proto-version。设置要使用的协议版本。有效字符串(不区分大小写)为:

SSL2
Select SSL protocol version 2.
选择 SSL 协议版本 2。

SSL3
Select SSL protocol version 3.
选择 SSL 协议版本 3。

SSL23
Select the best available SSL or TLS protocol.
选择最佳可用的 SSL 或 TLS 协议。

TLS1
Select TLS protocol version 1.
选择 TLS 协议版本 1。

TLS1.1
Select TLS protocol version 1.1.
选择 TLS 协议版本 1.1。

TLS1.2
Select TLS protocol version 1.2. When this option is not provided OpenSSL negotiates the mothod with its peer.
选择 TLS 协议版本 1.2。当未提供此选项时,OpenSSL 会与其对等方协商方法。

min-proto-version
This option tells OpenSSL to use this or a later SSL/TLS protocol version and refuses to accept a lower/older protocol. Valid syntax is:
此选项告诉 OpenSSL 使用此版本或更高版本的 SSL/TLS 协议,并拒绝接受较低/旧的协议。有效的语法是:

SSL2
Select SSL protocol version 2.
选择 SSL 协议版本 2。

SSL3
Select SSL protocol version 3.
选择 SSL 协议版本 3。

TLS1

TLS1.0
Select TLS protocol version 1.
选择 TLS 协议版本 1。

TLS1.1
Select TLS protocol version 1.1.
选择 TLS 协议版本 1.1。

TLS1.2
Select TLS protocol version 1.2.
选择 TLS 协议版本 1.2。

TLS1.3
Select TLS protocol version 1.3.
选择 TLS 协议版本 1.3。

openssl-max-proto-version
This option is similar to min-proto-version, however, it disallows use of a higher protocol version. Useful for testing the peer.
此选项类似于 min-proto-version,但是禁止使用更高的协议版本。对于测试对等方很有用。

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!
控制对对等方证书的检查。默认值为 1(true)。禁用验证可能会使您的套接字对所有人开放,使加密无效!

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.
指定用于身份验证的证书和私钥文件。证书必须采用 OpenSSL 格式(*.pem)。在使用 openssl-listen 时,强烈建议使用此选项。除了使用 cipher aNULL 外,当没有提供证书时,将出现“没有共享密码”错误。

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.
指定具有私钥的文件。私钥可以在此文件中,也可以在使用 cert 选项给出的文件中。必须证明拥有证书所有权的一方需要私钥。

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.
指定具有 Diffie Hellman 参数的文件。这些参数也可以在使用 cert 选项给出的文件中,此时不需要 dhparams 选项。

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.
指定具有受信任(根)授权证书的文件。该文件必须采用 PEM 格式,并且应包含一个或多个证书。检查对等方身份验证的一方仅信任此文件中的证书。

capath=<dirname>
Specifies the directory with the trusted (root) certificates. The directory must contain certificates in PEM format and their hashes (see OpenSSL documentation)
指定具有受信任(根)证书的目录。该目录必须包含以 PEM 格式和它们的哈希值(请参阅 OpenSSL 文档)格式的证书。

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.
在某些系统上,openssl 需要一个明确的随机数据源。指定套接字名称,其中熵收集守护程序(如 egd)提供随机数据,例如 /dev/egd-pool。

openssl-maxfraglen=<int>, maxfraglen=<int>
For client connections, make a Max Fragment Length Negotiation Request to the server to limit the maximum size fragment the server will send to us. Supported lengths are: 512, 1024, 2048, or 4096. Note that this option is not applicable for OPENSSL-LISTEN.
对于客户端连接,向服务器发出最大片段长度协商请求,以限制服务器将发送给我们的最大片段大小。支持的长度为:512、1024、2048 或 4096。请注意,此选项不适用于 OPENSSL-LISTEN。

openssl-maxsendfrag=<int>, maxsendfrag=<int>
Limit the maximum size of the fragment we will send to the other side. Supported length range: 512 - 16384. Note that under OPENSSL-LISTEN, the maximum fragment size may be further limited by the client's Maximum Fragment Length Negotiation Request, if it makes one.
限制我们发送到另一侧的片段的最大大小。支持的长度范围:512 - 16384。请注意,在 OPENSSL-LISTEN 下,如果客户端发出最大片段长度协商请求,片段大小可能会进一步受到限制。

pseudo
On systems where openssl cannot find an entropy source and where no entropy gathering daemon can be utilized, this option activates a mechanism for providing pseudo entropy. This is achieved by taking the current time in microseconds for feeding the libc pseudo random number generator with an initial value. openssl is then feeded with output from random() calls.
在 openssl 无法找到熵源且无法使用熵收集守护程序的系统上,此选项将激活提供伪熵的机制。这是通过以微秒为单位获取当前时间来为 libc 伪随机数生成器提供初始值来实现的。然后,openssl 会使用 random() 调用的输出。

NOTE:This mechanism is not sufficient for generation of secure keys!
注意:此机制不足以生成安全密钥!

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. NOTE: Requires OpenSSL 0.9.8 or higher and disabling compression with OpenSSL 0.9.8 affects all new connections in the process.
启用或禁用连接的压缩使用。将其设置为"none"会禁用压缩,将其设置为"auto"会让 OpenSSL 选择双方都支持的最佳算法。默认情况下不会更改任何与压缩相关的设置。注意:需要 OpenSSL 0.9.8 或更高版本,并且在 OpenSSL 0.9.8 中禁用压缩会影响进程中的所有新连接。

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.
指定对等证书必须匹配的通用名称。对于 OPENSSL-CONNECT 地址,这将覆盖给定的主机名或 IP 目标地址;对于 OPENSSL-LISTEN,这将打开对对等证书通用名称的检查。此选项仅在未禁用验证选项且所选密码提供对等证书时才有意义。

no-sni[=<bool>]
Do not use the client side Server Name Indication (SNI) feature that selects the desired server certificate.
不使用客户端端的服务器名称指示(SNI)功能,该功能选择所需的服务器证书。

Note: SNI is automatically used since socat version 1.7.4.0 and uses commonname or the given host name.
注意:自 socat 版本 1.7.4.0 起自动使用 SNI,并使用 commonname 或给定的主机名。

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.
将客户端端的服务器名称指示(SNI)主机名设置为与被寻址的服务器名称或通用名称不同。当服务器证书具有多个主机名或通配符名称时,这可能很有用,因为 SNI 主机名以明文传递到服务器,并可能被窃听;使用此选项可以传输所需证书的模拟名称。

fips
Enables FIPS mode if compiled in. For info about the FIPS encryption implementation standard see http://oss-institute.org/fips-faq.html. This mode might require that the involved certificates are generated with a FIPS enabled version of openssl. Setting or clearing this option on one socat address affects all OpenSSL addresses of this process.
如果已编译,则启用 FIPS 模式。有关 FIPS 加密实施标准的信息,请参阅 http://oss-institute.org/fips-faq.html。此模式可能要求所涉及的证书是使用启用了 FIPS 的 openssl 版本生成的。在一个 socat 地址上设置或清除此选项会影响此进程的所有 OpenSSL 地址。


RETRY option group 重试选项组

Options that control retry of some system calls, especially connection attempts.
控制某些系统调用重试的选项,特别是连接尝试的选项。

retry=<num>
Number of retries before the connection or listen attempt is aborted. Default is 0, which means just one attempt.
在连接或监听尝试被放弃之前的重试次数。默认值为 0,表示只尝试一次。

interval=<timespec>
Time between consecutive attempts (seconds, [timespec]). Default is 1 second.
两次尝试之间的时间间隔(秒,[时间规范])。默认为 1 秒。

forever
Performs an unlimited number of retry attempts.
执行无限次重试尝试。


INTERFACE option group INTERFACE 选项组

These options may be applied to addresses INTERFACE and TUN. These address types and options are currently only implemented on Linux operating system.
这些选项可以应用于地址 INTERFACE 和 TUN。这些地址类型和选项目前仅在 Linux 操作系统上实现。

Note regarding VLANs: On incoming packets the Linux kernel strips off the VLAN tag before passing the data to the user space program on raw sockets. Special measures are required to get the VLAN information, see packet(7) PACKET_AUXDATA, and to optionally insert the tag into the packet again, use option retrieve-vlan when you need this.
关于 VLAN 的注意事项:在传入数据包上,Linux 内核会在将数据传递给原始套接字上的用户空间程序之前剥离 VLAN 标记。需要采取特殊措施才能获取 VLAN 信息,请参阅 packet(7) PACKET_AUXDATA,并在需要时使用选项 retrieve-vlan 将标记再次插入数据包中。

retrieve-vlan
On packets incoming on raw sockets, retrieve the VLAN information and insert it into the packets for further processing (Linux)
在原始套接字上传入的数据包中,检索 VLAN 信息并将其插入数据包以进行进一步处理(Linux)

iff-up
Sets the TUN network interface status UP. Strongly recommended.
设置 TUN 网络接口状态为 UP。强烈推荐。

iff-broadcast
Sets the BROADCAST flag of the TUN network interface.
设置 TUN 网络接口的广播标志。

iff-debug
Sets the DEBUG flag of the TUN network interface.
设置 TUN 网络接口的调试标志。

iff-loopback
Sets the LOOPBACK flag of the TUN network interface.
设置 TUN 网络接口的 LOOPBACK 标志。

iff-pointopoint
Sets the POINTOPOINT flag of the TUN device.
设置 TUN 设备的 POINTOPOINT 标志。

iff-notrailers
Sets the NOTRAILERS flag of the TUN device.
设置 TUN 设备的 NOTRAILERS 标志。

iff-running
Sets the RUNNING flag of the TUN device.
设置 TUN 设备的 RUNNING 标志。

iff-noarp
Sets the NOARP flag of the TUN device.
设置 TUN 设备的 NOARP 标志。

iff-promisc
Sets the PROMISC flag of the TUN device.
设置 TUN 设备的 PROMISC 标志。

iff-allmulti
Sets the ALLMULTI flag of the TUN device.
设置 TUN 设备的 ALLMULTI 标志。

iff-master
Sets the MASTER flag of the TUN device.
设置 TUN 设备的 MASTER 标志。

iff-slave
Sets the SLAVE flag of the TUN device.
设置 TUN 设备的 SLAVE 标志。

iff-multicast
Sets the MULTICAST flag of the TUN device.
设置 TUN 设备的 MULTICAST 标志。

iff-portsel
Sets the PORTSEL flag of the TUN device.
设置 TUN 设备的 PORTSEL 标志。

iff-automedia
Sets the AUTOMEDIA flag of the TUN device.
设置 TUN 设备的 AUTOMEDIA 标志。

iff-dynamic
Sets the DYNAMIC flag of the TUN device.
设置 TUN 设备的 DYNAMIC 标志。


TUN option group TUN 选项组

Options that control Linux TUN/TAP interface device addresses.
控制 Linux TUN/TAP 接口设备地址的选项。

tun-device=<device-file>
Instructs socat to take another path for the TUN clone device. Default is /dev/net/tun.
指示 socat 为 TUN 克隆设备采取另一条路径。默认为 /dev/net/tun

tun-name=<if-name>
Gives the resulting network interface a specific name instead of the system generated (tun0, tun1, etc.)
为生成的网络接口指定特定名称,而不是系统生成的名称(tun0、tun1 等)。

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.
设置 TUN 设备的类型;使用此选项生成 TAP 设备。请参阅 Linux 文档以了解这些类型之间的区别。当您尝试在两个 TUN 设备之间建立隧道时,它们的类型应该相同。

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_NO_PI 标志,该标志控制设备是否在隧道中包含附加的数据包信息。当您尝试在两个 TUN 设备之间建立隧道时,这些标志应具有相同的值。


POSIX-MQ option group POSIX-MQ 选项组

Options that may be applied to POSIX-MQ addresses.
可应用于 POSIX-MQ 地址的选项。

posixmq-priority (mq-prio)
Sets the priority of messages (packets) written to the queue, or the minimal priority of packet read from the queue.
设置写入队列的消息(数据包)的优先级,或从队列中读取的数据包的最小优先级。

DATA VALUES 数据值

This section explains the different data types that address parameters and address options can take.
本节解释了地址参数和地址选项可以采用的不同数据类型。

address-range 地址范围
Is currently only implemented for IPv4 and IPv6. See address-option `range'
目前仅适用于 IPv4 和 IPv6。请参阅地址选项“范围”

bool 布尔值
"0" or "1"; if value is omitted, "1" is taken.
"0" 或 "1"; 如果值被省略,将采用 "1"。

byte 字节
An unsigned int number, read with strtoul() , lower or equal to UCHAR_MAX .
一个无符号整数,读取时应小于或等于 UCHAR_MAX

command-line 命令行
A string specifying a program name and its arguments, separated by single spaces.
一个字符串,指定程序名称及其参数,用单个空格分隔。

data 数据
This is a more general data specification. The given text string contains information about the target data type and value. Generally a leading character specifies the type of the following data item. In its specific context a default data type may exist.
这是一个更通用的数据规范。给定的文本字符串包含有关目标数据类型和值的信息。通常,前导字符指定后续数据项的类型。在其特定上下文中可能存在默认数据类型。

Currently only the following specifications are implemented:
目前只实现了以下规范:

i
A signed integer number, stored in host byte order.
以主机字节顺序存储的有符号整数。

Example: i-1000 (Integer number -1000)
示例:i-1000(整数-1000)

I
An unsigned integer number, stored in host byte order.
一个无符号整数,以主机字节顺序存储。

l
A signed long integer number, stored in host byte order.
一个有符号长整数,以主机字节顺序存储。

L
An unsigned long integer number, stored in host byte order.
一个无符号长整数,以主机字节顺序存储。

s
A signed short integer number, stored in host byte order.
一个有符号短整数,以主机字节顺序存储。

S
An unsigned short integer number, stored in host byte order.
一个无符号短整数,以主机字节顺序存储。

b
A signed byte (signed char).
一个有符号字节(有符号字符)。

B
An unsigned byte (unsigned char).
一个无符号字节(无符号字符)。

x
Following is an even number of hex digits, stored as sequence of bytes.
以下是偶数个十六进制数字,存储为字节序列。

Example: x7f000001 (IP address 127.0.0.1)
示例:x7f000001(IP 地址 127.0.0.1)

"
Following is a string that is used with the common conversions \n \r \t \f \b \a \e \0; the string must be closed with '"'. Please note that the quotes and backslashes need to be escaped from shell and socat conversion.
以下是与常见转换一起使用的字符串 \n \r \t \f \b \a \e \0;字符串必须用 '"' 结束。请注意,引号和反斜杠需要从 shell 和 socat 转换中转义。

Example: "Hello world!\n"
示例:"你好,世界!\n"

'
A single char, with the usual conversions. Please note that the quotes and backslashes need to be escaped from shell and socat conversion.
一个单个字符,带有通常的转换。请注意,引号和反斜杠需要从 shell 和 socat 转换中转义。

Example: 'a' 例子:'a'
Data items may be separated with white space without need to repeat the type specifier again.
数据项可以用空格分隔,无需再次重复类型说明符。

directory 目录
A string with usual UN*X directory name semantics.
具有通常 UN*X 目录名称语义的字符串。

facility 设施
The name of a syslog facility in lower case characters.
以小写字符表示的 syslog 设施的名称。

fdnum
An unsigned int type, read with strtoul() , specifying a UN*X file descriptor.
一个无符号整数类型,使用 strtoul() 读取,指定一个 UNIX 文件描述符。

filename 文件名
A string with usual UN*X filename semantics.
具有通常 UN*X 文件名语义的字符串。

group 
If the first character is a decimal digit, the value is read with strtoul() as unsigned integer specifying a group id. Otherwise, it must be an existing group name.
如果第一个字符是十进制数字,则该值将以 strtoul() 为无符号整数读取,指定组 ID。否则,它必须是现有的组名。

int
A number following the rules of the strtol() function with base "0", i.e. decimal number, octal number with leading "0", or hexadecimal number with leading "0x". The value must fit into a C int.
遵循 strtol() 函数规则的数字,基数为“0”,即十进制数、带有前导“0”的八进制数,或带有前导“0x”的十六进制数。该值必须适合于 C int。

interface 接口
A string specifying the device name of a network interface as shown by ifconfig or procan, e.g. "eth0".
一个字符串,指定网络接口的设备名称,如 ifconfig 或 procan 中所示,例如 "eth0"。

IP address IP 地址
An IPv4 address in numbers-and-dots notation, an IPv6 address in hex notation enclosed in brackets, or a hostname that resolves to an IPv4 or an IPv6 address.
以点分十进制表示的 IPv4 地址,用括号括起来的十六进制表示的 IPv6 地址,或解析为 IPv4 或 IPv6 地址的主机名。

Examples: 127.0.0.1, [::1], www.dest-unreach.org, dns1
示例:127.0.0.1,[::1],www.dest-unreach.org,dns1

IPv4 address IPv4 地址
An IPv4 address in numbers-and-dots notation or a hostname that resolves to an IPv4 address.
一个以点分十进制表示法或解析为 IPv4 地址的主机名的 IPv4 地址。

Examples: 127.0.0.1, www.dest-unreach.org, dns2
示例:127.0.0.1,www.dest-unreach.org,dns2

IPv6 address IPv6 地址
An IPv6 address in hexnumbers-and-colons notation enclosed in brackets, or a hostname that resolves to an IPv6 address.
一个用十六进制数字和冒号表示的 IPv6 地址,括号括起来,或者解析为 IPv6 地址的主机名。

Examples: [::1], [1234:5678:9abc:def0:1234:5678:9abc:def0], ip6name.domain.org
示例: [::1], [1234:5678:9abc:def0:1234:5678:9abc:def0], ip6name.domain.org

long 
A number read with strtol() . The value must fit into a C long.
使用 strtol() 读取的数字。该值必须适合于 C 长。

long long 长长的
A number read with strtoll() . The value must fit into a C long long.
使用 strtoll() 读取的数字。该值必须适合于 C 的长长整型。

off_t
An implementation dependend signed number, usually 32 bits, read with strtol or strtoll.
一个实现相关的有符号数字,通常为 32 位,使用 strtol 或 strtoll 读取。

off64_t
An implementation dependend signed number, usually 64 bits, read with strtol or strtoll.
一个实现相关的有符号数字,通常为 64 位,使用 strtol 或 strtoll 读取。

mode_t 模式_t
An unsigned integer, read with strtoul() , specifying mode (permission) bits.
一个无符号整数,使用 strtoul() 读取,指定模式(权限)位。

pid_t 进程 ID_t
A number, read with strtol() , specifying a process id.
一个数字,使用 strtol() 读取,指定一个进程 ID。

port 端口
A uint16_t (16 bit unsigned number) specifying a TCP or UDP port, read with strtoul() .
一个 uint16_t(16 位无符号数),指定一个 TCP 或 UDP 端口,使用 strtoul() 读取。

protocol 协议
An unsigned 8 bit number, read with strtoul() .
一个无符号的 8 位数字,与 strtoul() 一起读取。

size_t 大小_t
An unsigned number with size_t limitations, read with strtoul .
一个带有 size_t 限制的无符号数字,使用 strtoul 读取。

sockname
A socket address. See address-option `bind'
一个套接字地址。请参阅地址选项 `bind'。

string 字符串
A sequence of characters, not containing '\0' and, depending on the position within the command line, ':', ',', or "!!". Note that you might have to escape shell meta characters in the command line.
一系列字符,不包含'\0',并且根据命令行中的位置可能包含':', ',', 或 "!!"。请注意,您可能需要在命令行中转义 shell 元字符。

TCP service TCP 服务
A service name, not starting with a digit, that is resolved by getservbyname() , or an unsigned int 16 bit number read with strtoul() .
一个服务名称,不以数字开头,由 getservbyname() 解析,或者使用 strtoul() 读取的无符号 16 位整数。

timeval 时间值
A double float specifying seconds; the number is mapped into a struct timeval, consisting of seconds and microseconds.
一个双精度浮点数,指定秒数;该数字被映射为一个由秒和微秒组成的结构时间值。

timespec 时间结构
A double float specifying seconds; the number is mapped into a struct timespec, consisting of seconds and nanoseconds.
一个双精度浮点数,指定秒数;该数字被映射为一个结构 timespec,包括秒和纳秒。

UDP service UDP 服务
A service name, not starting with a digit, that is resolved by getservbyname() , or an unsigned int 16 bit number read with strtoul() .
一个服务名称,不以数字开头,由 getservbyname() 解析,或者使用 strtoul() 读取的无符号 16 位整数。

unsigned int 无符号整数
A number read with strtoul() . The value must fit into a C unsigned int.
使用 strtoul() 读取的数字。该值必须适合于 C 中的无符号整数。

user 用户
If the first character is a decimal digit, the value is read with strtoul() as unsigned integer specifying a user id. Otherwise, it must be an existing user name.
如果第一个字符是十进制数字,则该值将以 strtoul() 为无符号整数读取,指定用户 ID。否则,它必须是现有的用户名。

VSOCK cid
A uint32_t (32 bit unsigned number) specifying a VSOCK Context Identifier (CID), read with strtoul() . There are several special addresses: VMADDR_CID_ANY (-1U) means any address for binding; VMADDR_CID_HOST (2) is the well-known address of the host.
一个 uint32_t(32 位无符号数),指定一个 VSOCK 上下文标识符(CID),使用 strtoul() 读取。有几个特殊地址:VMADDR_CID_ANY(-1U)表示绑定的任何地址;VMADDR_CID_HOST(2)是主机的众所周知地址。

VSOCK port VSOCK 端口
A uint32_t (32 bit unsigned number) specifying a VSOCK port, read with strtoul() .
一个 uint32_t(32 位无符号数),指定一个 VSOCK 端口,使用 strtoul() 读取。

EXAMPLES 示例


socat - TCP4:www.domain.org:80

transfers data between STDIO (-) and a TCP4 connection to port 80 of host www.domain.org. This example results in an interactive connection similar to telnet or netcat. The stdin terminal parameters are not changed, so you may close the relay with ^D or abort it with ^C.
在 STDIO (-) 和主机 www.domain.org 的端口 80 的 TCP4 连接之间传输数据。此示例会产生类似 telnet 或 netcat 的交互式连接。标准输入终端参数不会更改,因此您可以使用 ^D 关闭中继,或者使用 ^C 中止它。


socat -d -d \ READLINE,history=$HOME/.http_history \ TCP4:www.domain.org:www,crnl

this is similar to the previous example, but you can edit the current line in a bash like manner (READLINE) and use the history file .http_history; socat prints messages about progress (-d -d). The port is specified by service name (www), and correct network line termination characters (crnl) instead of NL are used.
这与前面的示例类似,但您可以像在 bash 中一样编辑当前行(READLINE),并使用历史文件 .http_history;socat 会打印有关进度的消息(-d -d)。端口由服务名称(www)指定,并使用正确的网络行终止字符(crnl)而不是 NL。


socat \ TCP4-LISTEN:www \ TCP4:www.domain.org:www

installs a simple TCP port forwarder. With TCP4-LISTEN it listens on local port "www" until a connection comes in, accepts it, then connects to the remote host (TCP4) and starts data transfer. It will not accept a second connection.
安装一个简单的 TCP 端口转发器。使用 TCP4-LISTEN 监听本地端口“www”,直到有连接进来,接受连接,然后连接到远程主机(TCP4)并开始数据传输。它不会接受第二个连接。


socat -d -d -lmlocal2 \ TCP4-LISTEN:80,bind=myaddr1,su=nobody,fork,range=10.0.0.0/8,reuseaddr \ TCP4:www.domain.org:80,bind=myaddr2

TCP port forwarder, each side bound to another local IP address (bind). This example handles an almost arbitrary number of parallel or consecutive connections by fork'ing a new process after each accept() . It provides a little security by su'ing to user nobody after forking; it only permits connections from the private 10 network (range); due to reuseaddr, it allows immediate restart after master process's termination, even if some child sockets are not completely shut down. With -lmlocal2, socat logs to stderr until successfully reaching the accept loop. Further logging is directed to syslog with facility local2.
TCP 端口转发器,每一侧都绑定到另一个本地 IP 地址(bind)。此示例通过在每个 accept() 之后 fork 一个新进程来处理几乎任意数量的并行或连续连接。在 fork 后通过 su 切换到用户 nobody 提供了一点安全性;它只允许来自私有 10 网络的连接(range);由于 reuseaddr,即使一些子套接字没有完全关闭,它也允许主进程终止后立即重新启动。使用-lmlocal2,socat 在成功进入接受循环之前将日志记录到 stderr。进一步的日志记录将定向到带有 local2 设施的 syslog。


socat \ TCP4-LISTEN:5555,fork,tcpwrap=script \ EXEC:/bin/myscript,chroot=/home/sandbox,su-d=sandbox,pty,stderr

a simple server that accepts connections (TCP4-LISTEN) and fork's a new child process for each connection; every child acts as single relay. The client must match the rules for daemon process name "script" in /etc/hosts.allow and /etc/hosts.deny, otherwise it is refused access (see "man 5 hosts_access"). For EXEC'uting the program, the child process chroot's to /home/sandbox, su's to user sandbox, and then starts the program /home/sandbox/bin/myscript. Socat and myscript communicate via a pseudo tty (pty); myscript's stderr is redirected to stdout, so its error messages are transferred via socat to the connected client.
一个简单的服务器,接受连接(TCP4-LISTEN),为每个连接 fork 出一个新的子进程;每个子进程充当单个中继。客户端必须符合在/etc/hosts.allow 和/etc/hosts.deny 中守护进程名称为"script"的规则,否则将被拒绝访问(参见"man 5 hosts_access")。为了执行程序,子进程 chroot 到/home/sandbox,su 到用户 sandbox,然后启动程序/home/sandbox/bin/myscript。Socat 和 myscript 通过伪终端(pty)进行通信;myscript 的 stderr 被重定向到 stdout,因此其错误消息通过 socat 传输到连接的客户端。


socat \ EXEC:"mail.sh target@domain.com",fdin=3,fdout=4 \ TCP4:mail.relay.org:25,crnl,bind=alias1.server.org,mss=512

mail.sh is a shell script, distributed with socat, that implements a simple SMTP client. It is programmed to "speak" SMTP on its FDs 3 (in) and 4 (out). The fdin and fdout options tell socat to use these FDs for communication with the program. Because mail.sh inherits stdin and stdout while socat does not use them, the script can read a mail body from stdin. Socat makes alias1 your local source address (bind), cares for correct network line termination (crnl) and sends at most 512 data bytes per packet (mss).
mail.sh 是一个 shell 脚本,与 socat 一起分发,实现了一个简单的 SMTP 客户端。它被编程为在其 FDs 3(输入)和 4(输出)上“说” SMTP。fdin 和 fdout 选项告诉 socat 使用这些 FDs 与程序通信。因为 mail.sh 继承了 stdin 和 stdout,而 socat 没有使用它们,所以脚本可以从 stdin 读取邮件正文。Socat 使 alias1 成为您的本地源地址(绑定),关心正确的网络行终止(crnl),并且每个数据包发送最多 512 字节(mss)。


socat \ -,escape=0x0f \ /dev/ttyS0,rawer,crnl

opens an interactive connection via the serial line, e.g. for talking with a modem. rawer sets the console's and ttyS0's terminal parameters to practicable values, crnl converts to correct newline characters. escape allows terminating the socat process with character control-O. Consider using READLINE instead of the first address.
通过串行线路打开一个交互式连接,例如用于与调制解调器通信。rawer 将控制台和 ttyS0 的终端参数设置为可行值,crnl 转换为正确的换行符。escape 允许使用字符控制-O 终止 socat 进程。考虑使用 READLINE 而不是第一个地址。


socat \ UNIX-LISTEN:/tmp/.X11-unix/X1,fork \ SOCKS4:host.victim.org:127.0.0.1:6000,socksuser=nobody,sourceport=20

with UNIX-LISTEN, socat opens a listening UNIX domain socket /tmp/.X11-unix/X1. This path corresponds to local XWindow display :1 on your machine, so XWindow client connections to DISPLAY=:1 are accepted. Socat then speaks with the SOCKS4 server host.victim.org that might permit sourceport 20 based connections due to an FTP related weakness in its static IP filters. Socat pretends to be invoked by socksuser nobody, and requests to be connected to loopback port 6000 (only weak sockd configurations will allow this). So we get a connection to the victims XWindow server and, if it does not require MIT cookies or Kerberos authentication, we can start work. Please note that there can only be one connection at a time, because TCP can establish only one session with a given set of addresses and ports.
使用 UNIX-LISTEN,socat 打开一个监听 UNIX 域套接字 /tmp/.X11-unix/X1。此路径对应于您机器上的本地 XWindow 显示 :1,因此 XWindow 客户端连接到 DISPLAY=:1 将被接受。Socat 然后与 SOCKS4 服务器 host.victim.org 通信,该服务器可能允许基于 FTP 相关弱点的源端口 20 连接,因为其静态 IP 过滤器中存在漏洞。Socat 假装被 socksuser nobody 调用,并请求连接到回环端口 6000(只有弱 sockd 配置才会允许此操作)。因此,我们可以连接到受害者的 XWindow 服务器,并且如果它不需要 MIT cookies 或 Kerberos 认证,我们就可以开始工作。请注意,一次只能有一个连接,因为 TCP 只能与给定的地址和端口集建立一个会话。


socat -u \ /tmp/readdata,seek-end=0,ignoreeof \ STDIO

this is an example for unidirectional data transfer (-u). Socat transfers data from file /tmp/readdata (implicit address GOPEN), starting at its current end (seek-end=0 lets socat start reading at current end of file; use seek=0 or no seek option to first read the existing data) in a "tail -f" like mode (ignoreeof). The "file" might also be a listening UNIX domain socket (do not use a seek option then).
这是一个单向数据传输的示例(-u)。Socat 从文件/tmp/readdata(隐式地址 GOPEN)传输数据,从其当前末尾开始(seek-end=0 让 socat 从文件当前末尾开始读取;使用 seek=0 或不使用 seek 选项来首先读取现有数据),以“tail -f”模式(ignoreeof)进行。该“文件”也可能是一个监听的 UNIX 域套接字(那时不要使用 seek 选项)。


(sleep 5; echo PASSWORD; sleep 5; echo ls; sleep 1) | socat - \ EXEC:'ssh -l user server',pty,setsid,ctty
(睡眠 5 秒;echo PASSWORD;睡眠 5 秒;echo ls;睡眠 1 秒)| socat - \ EXEC:'ssh -l user server',pty,setsid,ctty

EXEC'utes an ssh session to server. Uses a pty for communication between socat and ssh, makes it ssh's controlling tty (ctty), and makes this pty the owner of a new process group (setsid), so ssh accepts the password from socat.
执行一个到服务器的 ssh 会话。使用 pty 在 socat 和 ssh 之间进行通信,使其成为 ssh 的控制 tty(ctty),并使此 pty 成为新进程组的所有者(setsid),因此 ssh 接受来自 socat 的密码。


socat -u \ TCP4-LISTEN:3334,reuseaddr,fork \ OPEN:/tmp/in.log,creat,append

implements a simple network based message collector. For each client connecting to port 3334, a new child process is generated (option fork). All data sent by the clients are append'ed to the file /tmp/in.log. If the file does not exist, socat creat's it. Option reuseaddr allows immediate restart of the server process.
实现了一个简单的基于网络的消息收集器。对于连接到端口 3334 的每个客户端,都会生成一个新的子进程(选项 fork)。所有客户端发送的数据都会追加到文件/tmp/in.log 中。如果文件不存在,socat 会创建它。选项 reuseaddr 允许立即重新启动服务器进程。


socat \ READLINE,noecho='[Pp]assword:' \ EXEC:'ftp ftp.server.com',pty,setsid,ctty

wraps a command line history (READLINE) around the EXEC'uted ftp client utility. This allows editing and reuse of FTP commands for relatively comfortable browsing through the ftp directory hierarchy. The password is echoed! pty is required to have ftp issue a prompt. Nevertheless, there may occur some confusion with the password and FTP prompts.
将一个命令行历史(READLINE)包装在执行的 ftp 客户端实用程序周围。这允许编辑和重用 FTP 命令,以便相对舒适地浏览 ftp 目录层次结构。密码会被回显!需要 pty 以使 ftp 发出提示。尽管如此,密码和 FTP 提示可能会引起一些混淆。


socat \ PTY,link=$HOME/dev/vmodem0,rawer,wait-slave \ EXEC:'"ssh modemserver.us.org socat - /dev/ttyS0,nonblock,rawer"'
socat \ PTY,link=$HOME/dev/vmodem0,rawer,wait-slave \ EXEC:'“ssh modemserver.us.org socat - /dev/ttyS0,nonblock,rawer”'

generates a pseudo terminal device (PTY) on the client that can be reached under the symbolic link $HOME/dev/vmodem0. An application that expects a serial line or modem can be configured to use $HOME/dev/vmodem0; its traffic will be directed to a modemserver via ssh where another socat instance links it to /dev/ttyS0.
在客户端上生成一个伪终端设备(PTY),可以通过符号链接$HOME/dev/vmodem0 访问。可以配置期望使用串行线路或调制解调器的应用程序使用$HOME/dev/vmodem0;其流量将通过 ssh 定向到 modemserver,另一个 socat 实例将其链接到/dev/ttyS0。


sudo socat --experimental \ TCP4-LISTEN:8000,reuseaddr,fork,netns=namespace1 \ TCP4-CONNECT:server2:8000
使用 sudo socat --experimental \ TCP4-LISTEN:8000,reuseaddr,fork,netns=namespace1 \ TCP4-CONNECT:server2:8000

creates a listener in the given network namespace that accepts TCP connections on port 8000 and forwards them to server2.
在给定的网络命名空间中创建一个监听器,接受端口 8000 上的 TCP 连接,并将其转发到 server2。


sudo socat --experimental \ TUN:192.168.2.1/24,up \ TUN:192.168.2.2/24,up,netns=namespace2
使用 sudo socat --experimental \ TUN:192.168.2.1/24,up \ TUN:192.168.2.2/24,up,netns=namespace2

creates two virtual network interfaces, one in default namespace, the other one in namespace2, and forwards packets between them, acting as a virtual network connection.
在默认命名空间中创建两个虚拟网络接口,一个在默认命名空间中,另一个在命名空间 2 中,并在它们之间转发数据包,充当虚拟网络连接。


socat \ TCP4-LISTEN:2022,reuseaddr,fork \ PROXY:proxy.local:www.domain.org:22,proxyport=3128,proxyauth=username:s3cr3t

starts a forwarder that accepts connections on port 2022, and directs them through the proxy daemon listening on port 3128 (proxyport) on host proxy.local, using the CONNECT method, where they are authenticated as "username" with "s3cr3t" (proxyauth). proxy.local should establish connections to host www.domain.org on port 22 then.
启动一个转发器,接受在端口 2022 上的连接,并通过代理守护程序将它们定向到在主机 proxy.local 上监听端口 3128(proxyport)的代理守护程序,使用 CONNECT 方法进行身份验证为“username”和“s3cr3t”(proxyauth)。proxy.local 应该建立到主机 www.domain.org 的端口 22 的连接。


socat - \ SSL:server:4443,cafile=./server.crt,cert=./client.pem

is an OpenSSL client that tries to establish a secure connection to an SSL server. Option cafile specifies a file that contains trust certificates: we trust the server only when it presents one of these certificates and proofs that it owns the related private key. Otherwise the connection is terminated. With cert a file containing the client certificate and the associated private key is specified. This is required in case the server wishes a client authentication; many Internet servers do not.
是一个 OpenSSL 客户端,尝试与 SSL 服务器建立安全连接。选项 cafile 指定一个包含信任证书的文件:只有当服务器呈现其中一个证书并证明拥有相关私钥时,我们才信任服务器。否则连接将被终止。使用 cert 指定一个包含客户端证书和相关私钥的文件。在服务器需要客户端认证的情况下,这是必需的;许多互联网服务器不需要。

The first address ('-') can be replaced by almost any other socat address.
第一个地址('-')可以被几乎任何其他 socat 地址替换。


socat \ OPENSSL-LISTEN:4443,reuseaddr,pf=ip4,fork,cert=./server.pem,cafile=./client.crt \ PIPE

is an OpenSSL server that accepts TCP connections, presents the certificate from the file server.pem and forces the client to present a certificate that is verified against cafile.crt.
是一个 OpenSSL 服务器,接受 TCP 连接,提供来自文件 server.pem 的证书,并强制客户端提供一个针对 cafile.crt 验证的证书。

The second address ('PIPE') can be replaced by almost any other socat address.
第二个地址('PIPE')可以被几乎任何其他 socat 地址替换。

For instructions on generating and distributing OpenSSL keys and certificates see the additional socat docu socat-openssl.txt.
有关生成和分发 OpenSSL 密钥和证书的说明,请参阅附加的 socat 文档 socat-openssl.txt


echo | socat -u - \ FILE:/tmp/bigfile,create,largefile,seek=100000000000

creates a 100GB+1B sparse file; this requires a file system type that supports this (ext2, ext3, ext4, reiserfs, xfs; not minix, vfat). The operation of writing 1 byte might take long (reiserfs: some minutes; ext2: "no" time), and the resulting file can consume some disk space with just its inodes (reiserfs: 2MB; ext2: 16KB).
创建一个 100GB+1B 的稀疏文件;这需要支持此操作的文件系统类型(ext2、ext3、ext4、reiserfs、xfs;不支持 minix、vfat)。写入 1 字节的操作可能需要很长时间(reiserfs:几分钟;ext2:“无”时间),并且生成的文件可能会消耗一些磁盘空间,仅仅是其索引节点(reiserfs:2MB;ext2:16KB)。


socat \ TCP-L:7777,reuseaddr,fork \ SYSTEM:'filan -i 0 -s >&2',nofork

listens for incoming TCP connections on port 7777. For each accepted connection, invokes a shell. This shell has its stdin and stdout directly connected to the TCP socket (nofork). The shell starts filan and lets it print the socket addresses to stderr (your terminal window).
监听端口 7777 上的传入 TCP 连接。对于每个接受的连接,调用一个 shell。这个 shell 的标准输入和标准输出直接连接到 TCP 套接字(nofork)。shell 启动 filan 并让它将套接字地址打印到 stderr(您的终端窗口)。


echo -e "\0\14\0\0\c" | socat -u - \ FILE:/usr/bin/squid.exe,seek=0x00074420

functions as primitive binary editor: it writes the 4 bytes 000 014 000 000 to the executable /usr/bin/squid.exe at offset 0x00074420 (this was a real world patch to make the squid executable from Cygwin run under Windows, in 2004).
作为原始二进制编辑器的功能:它将 4 个字节 000 014 000 000 写入可执行文件/usr/bin/squid.exe,偏移量为 0x00074420(这是 2004 年对 Cygwin 下的 Squid 可执行文件进行的一个真实世界补丁,以在 Windows 下运行)。


socat - \ TCP:www.blackhat.org:31337,readbytes=1000

connects to an unknown service and prevents being flooded.
连接到一个未知服务并防止被洪水攻击。


socat -U \ TCP:target:9999,end-close \ TCP-L:8888,reuseaddr,fork

merges data arriving from different TCP streams on port 8888 to just one stream to target:9999. The end-close option prevents the child processes forked off by the second address from terminating the shared connection to 9999 (close(2) just unlinks the inode which stays active as long as the parent process lives; shutdown(2) would actively terminate the connection).
将到达端口 8888 的来自不同 TCP 流的数据合并到一个流中,发送到目标:9999。end-close 选项防止第二个地址分叉出的子进程终止到 9999 的共享连接(close(2)仅取消链接,只要父进程存在,inode 就保持活动状态;shutdown(2)将主动终止连接)。


socat \ TCP-LISTEN:10021,reuseaddr,socktype=6,protocol=33,fork \ PIPE

is a simple DCCP echo server. DCCP is now directly provisioned in socat, however this example shows how use socats TCP procedures and change the socket type to SOCK_DCCP=6 (on Linux) and the IP protocol to IPPROTO_DCCP=33.
是一个简单的 DCCP 回显服务器。DCCP 现在直接在 socat 中配置,但是这个示例展示了如何使用 socat 的 TCP 过程并将套接字类型更改为 SOCK_DCCP=6(在 Linux 上)以及 IP 协议更改为 IPPROTO_DCCP=33。


socat - \ TCP:<server>:10021,reuseaddr,socktype=6,protocol=33,fork

is a simple DCCP client. DCCP is now directly provisioned in socat, however this example shows how use socats TCP procedures, but changes the socket type to SOCK_DCCP=6 (on Linux) and the IP protocol to IPPROTO_DCCP=33.
是一个简单的 DCCP 客户端。DCCP 现在直接在 socat 中配置,但是这个示例展示了如何使用 socat 的 TCP 过程,但更改套接字类型为 SOCK_DCCP=6(在 Linux 上)以及 IP 协议更改为 IPPROTO_DCCP=33。


socat - \ UDP4-DATAGRAM:192.168.1.0:123,sp=123,broadcast,range=192.168.1.0/24

sends a broadcast to the network 192.168.1.0/24 and receives the replies of the timeservers there. Ignores NTP packets from hosts outside this network.
发送广播到网络 192.168.1.0/24,并接收那里的时间服务器的回复。忽略来自该网络外部主机的 NTP 数据包。


socat - \ SOCKET-DATAGRAM:2:2:17:x007bxc0a80100x0000000000000000,bind=x007bx00000000x0000000000000000,setsockopt-int=1:6:1,range=x0000xc0a80100x0000000000000000:x0000xffffff00x0000000000000000

is semantically equivalent to the previous example, but all parameters are specified in generic form. the value 6 of setsockopt-int is the Linux value for SO_BROADCAST.
与前一个示例在语义上等效,但所有参数都以通用形式指定。 setsockopt-int 的值 6 是 Linux 中 SO_BROADCAST 的值。


socat - \ IP4-DATAGRAM:255.255.255.255:44,broadcast,range=10.0.0.0/8

sends a broadcast to the local network(s) using protocol 44. Accepts replies from the private address range only.
使用协议 44 向本地网络发送广播。仅接受来自私有地址范围的回复。


socat - \ UDP4-DATAGRAM:224.255.0.1:6666,bind=:6666,ip-add-membership=224.255.0.1:eth0

transfers data from stdin to the specified multicast address using UDP. Both local and remote ports are 6666. Tells the interface eth0 to also accept multicast packets of the given group. Multiple hosts on the local network can run this command, so all data sent by any of the hosts will be received by all the other ones. Note that there are many possible reasons for failure, including IP-filters, routing issues, wrong interface selection by the operating system, bridges, or a badly configured switch.
通过 UDP 将数据从 stdin 传输到指定的多播地址。本地和远程端口都是 6666。告诉接口 eth0 也接受给定组的多播数据包。本地网络上的多台主机可以运行此命令,因此任何主机发送的所有数据都将被其他主机接收。请注意,失败可能有许多原因,包括 IP 过滤器、路由问题、操作系统错误地选择接口、桥接或配置不当的交换机。


socat \ UDP:host2:4443 \ TUN:192.168.255.1/24,up

establishes one side of a virtual (but not private!) network with host2 where a similar process might run, with UDP-L and tun address 192.168.255.2. They can reach each other using the addresses 192.168.255.1 and 192.168.255.2. Note that streaming eg.via TCP or SSL does not guarantee to retain packet boundaries and might thus cause packet loss.
在 host2 上建立一个虚拟(但不是私有的!)网络的一侧,其中可能运行类似的进程,使用 UDP-L 和 tun 地址 192.168.255.2。它们可以使用地址 192.168.255.1 和 192.168.255.2 互相到达。请注意,通过 TCP 或 SSL 进行流式传输不能保证保留数据包边界,可能会导致数据包丢失。


socat - \ VSOCK-CONNECT:2:1234

establishes a VSOCK connection with the host (host is always reachable with the well-know CID=2) on 1234 port.
与主机(主机始终可通过已知 CID=2 访问)在 1234 端口建立 VSOCK 连接。


socat - \ VSOCK-LISTEN:1234

listens for a VSOCK connection on 1234 port.
在 1234 端口上监听 VSOCK 连接。


socat - \ VSOCK-CONNECT:31:4321,bind:5555

establishes a VSOCK connection with the guest that have CID=31 on 1234 port, binding the local socket to the 5555 port.
与 CID=31 的客户端在 1234 端口建立 VSOCK 连接,将本地套接字绑定到 5555 端口。


socat \ VSOCK-LISTEN:3333,reuseaddr,fork \ VSOCK-CONNECT:42,3333

starts a forwarder that accepts VSOCK connections on port 3333, and directs them to the guest with CID=42 on the same port.
启动一个接受端口 3333 上的 VSOCK 连接的转发器,并将它们定向到具有相同端口上 CID=42 的客户端。


socat \ VSOCK-LISTEN:22,reuseaddr,fork \ TCP:localhost:22

forwards VSOCK connections from 22 port to the local SSH server. Running this in a VM allows you to connect via SSH from the host using VSOCK, as in the example below.
将 VSOCK 连接从 22 端口转发到本地 SSH 服务器。在虚拟机中运行此命令允许您通过 VSOCK 从主机连接到 SSH,就像下面的示例一样。


socat \ TCP4-LISTEN:22222,reuseaddr,fork \ VSOCK-CONNECT:33:22

forwards TCP connections from 22222 port to the guest with CID=33 listening on VSOCK port 22. Running this in the host, allows you to connect via SSH running "ssh -p 22222 user@localhost", if the guest runs the example above.
将来自 22222 端口的 TCP 连接转发到 CID=33 上监听 VSOCK 端口 22 的虚拟机。在主机上运行此命令,允许您通过运行"ssh -p 22222 user@localhost"连接。如果虚拟机运行上述示例。


socat \ PTY,link=/var/run/ppp,rawer \ INTERFACE:hdlc0

circumvents the problem that pppd requires a serial device and thus might not be able to work on a synchronous line that is represented by a network device. socat creates a PTY to make pppd happy, binds to the network interface hdlc0, and can transfer data between both devices. Use pppd on device /var/run/ppp then.
解决了 pppd 需要串行设备的问题,因此可能无法在由网络设备表示的同步线上工作。socat 创建一个 PTY 以使 pppd 正常工作,绑定到网络接口 hdlc0 ,并可以在这两个设备之间传输数据。然后在设备 /var/run/ppp 上使用 pppd。


socat --experimental -u \ STDIO \ POSIXMQ-SEND:/queue1,unlink-early,mq-prio=10

Writes packets read from stdio (i.e., lines of input when run interactively) into POSIX message queue, with priority 10.
将从标准输入读取的数据包(即交互式运行时的输入行)写入具有优先级 10 的 POSIX 消息队列。


socat --experimental -u \ POSIXMQ-RECV:/queue1,fork,max-children=3 \ SYSTEM:"robot.sh"

Receives messages (packets) from POSIX message queue and, for each messages, forks a sub process that reads and processes the message. At most 3 sub processes are allowed at the same time.
从 POSIX 消息队列接收消息(数据包),对于每个消息,派生一个子进程来读取和处理消息。同时最多允许 3 个子进程。


socat -T 1 -d -d \ TCP-L:10081,reuseaddr,fork,crlf \ SYSTEM:"echo -e \"\\\"HTTP/1.0 200 OK\\\nDocumentType: text/plain\\\n\\\ndate: \$\(date\)\\\nserver:\$SOCAT_SOCKADDR:\$SOCAT_SOCKPORT\\\nclient: \$SOCAT_PEERADDR:\$SOCAT_PEERPORT\\\n\\\"\"; cat; echo -e \"\\\"\\\n\\\"\""

creates a very primitive HTTP echo server: each HTTP client that connects gets a valid HTTP reply that contains information about the client address and port as it is seen by the server host, the host address (which might vary on multihomed servers), and the original client request.
创建一个非常原始的 HTTP 回显服务器:每个连接的 HTTP 客户端都会收到一个有效的 HTTP 回复,其中包含有关客户端地址和端口的信息,如服务器主机所见,主机地址(在多宿主服务器上可能会有所不同),以及原始客户端请求。


socat -d -d \ UDP4-RECVFROM:9999,so-broadcast,so-timestamp,ip-pktinfo,ip-recverr,ip-recvopts,ip-recvtos,ip-recvttl!!- \ SYSTEM:'export; sleep 1' | grep SOCAT

waits for an incoming UDP packet on port 9999 and prints the environment variables provided by socat. On BSD based systems you have to replace ip-pktinfo with ip-recvdstaddr,ip-recvif. Especially of interest is SOCAT_IP_DSTADDR: it contains the target address of the packet which may be a unicast, multicast, or broadcast address.
等待端口 9999 上的 UDP 数据包,并打印由 socat 提供的环境变量。在基于 BSD 的系统中,您必须将 ip-pktinfo 替换为 ip-recvdstaddrip-recvif 。特别感兴趣的是 SOCAT_IP_DSTADDR:它包含数据包的目标地址,可以是单播、组播或广播地址。


echo -e "M-SEARCH * HTTP/1.1\nHOST: 239.255.255.250:1900\nMAN: \"ssdp:discover\"\nMX: 4\nST: \"ssdp:all\"\n" | \ socat - \ UDP-DATAGRAM:239.255.255.250:1900,crlf

sends an SSDP (Simple Service Discovery Protocol) query to the local network and collects and outputs the answers received.
发送一个 SSDP(简单服务发现协议)查询到本地网络,并收集和输出接收到的答复。


systemd-socket-activate -l 1077 --inetd socat ACCEPT:0,fork PIPE

systemd-socket-activate is a program for testing systemd socket activation of daemons. With --inetd it waits for a connection on the specified port. It does not accept the connection but passes the listening file descriptor as FDs 0 and 1. Socat accepts the waiting connection and starts data transfer.
systemd-socket-activate 是一个用于测试 systemd 守护程序的 socket 激活的程序。使用 --inetd 它会在指定端口等待连接。它不接受连接,而是将监听文件描述符作为 FDs 0 和 1 传递。Socat 接受等待的连接并开始数据传输。

DIAGNOSTICS 诊断

Socat uses a logging mechanism that allows filtering messages by severity. The severities provided are more or less compatible to the appropriate syslog priority. With one or up to four occurrences of the -d command line option, the lowest priority of messages that are issued can be selected. Each message contains a single uppercase character specifying the messages severity (one of F, E, W, N, I, or D)
Socat 使用一种日志记录机制,允许按严重性过滤消息。提供的严重性大致与适当的 syslog 优先级兼容。通过使用一到四个 -d 命令行选项,可以选择发出的消息的最低优先级。每条消息包含一个指定消息严重性的单个大写字符(F、E、W、N、I 或 D 中的一个)

FATAL: 致命错误:
Conditions that require unconditional and immediate program termination.
需要无条件和立即终止程序的条件。

ERROR: 错误:
Conditions that prevent proper program processing. Usually the program is terminated (see option -s).
阻止正确程序处理的条件。通常会终止程序(参见选项 -s)。

WARNING: 警告:
Something did not function correctly or is in a state where correct further processing cannot be guaranteed, but might be possible.
有些功能未能正常运行,或处于无法保证正确进一步处理的状态,但可能是可能的。

NOTICE: 注意:
Interesting actions of the program, e.g. for supervising socat in some kind of server mode.
程序的有趣操作,例如监视 socat 在某种服务器模式下的行为。

INFO: 信息:
Description of what the program does, and maybe why it happens. Allows monitoring the lifecycles of file descriptors.
程序的功能描述,以及可能发生的原因。允许监视文件描述符的生命周期。

DEBUG: 调试:
Description of how the program works, all system or library calls and their results.
程序运行方式的描述,所有系统或库调用及其结果。

Log messages can be written to stderr, to a file, or to syslog.
日志消息可以写入 stderr,文件或 syslog。

On exit, socat gives status 0 if it terminated due to EOF or inactivity timeout, with a positive value on error, and with a negative value on fatal error.
在退出时,如果由于 EOF 或不活动超时而终止,则 socat 返回状态 0,出现错误时返回正值,出现致命错误时返回负值。

FILES 文件

/usr/bin/socat
/usr/bin/filan
/usr/bin/procan

SIGNALS 信号

SIGUSR1:
Causes logging of current transfer statistics.
导致记录当前传输统计信息。

See also option --statistics
另请参阅选项 --statistics

ENVIRONMENT VARIABLES 环境变量

Input variables carry information from the environment to socat, output variables are set by socat for use in executed scripts and programs.
输入变量携带信息从环境到 socat,输出变量由 socat 设置,用于执行的脚本和程序。

In the output variables beginning with "SOCAT" this prefix is actually replaced by the upper case name of the executable or the value of option -lp.
在以 "SOCAT" 开头的输出变量中,此前缀实际上被可执行文件的大写名称或选项 -lp 的值替换。

SOCAT_DEFAULT_LISTEN_IP (input)
SOCAT_DEFAULT_LISTEN_IP(输入)
(Values 4 or 6) Sets the IP version to be used for listen, recv, and recvfrom addresses if no pf (protocol-family) option is given. Is overridden by socat options -4 or -6.
(值为 4 或 6)设置用于监听、接收和接收地址的 IP 版本,如果没有给出 pf(协议族)选项,则使用。被 socat 选项 -4 或 -6 覆盖。

SOCAT_PREFERRED_RESOLVE_IP (input)
SOCAT_PREFERRED_RESOLVE_IP(输入)
(Values 0, 4, or 6) Sets the IP version to be used when resolving target host names when version is not specified by address type, option pf (protocol-family), or address format. If name resolution does not return a matching entry, the first result (with differing IP version) is taken. With value 0, socat always selects the first record and its IP version.
(值为 0、4 或 6)设置在解析目标主机名称时要使用的 IP 版本,当未通过地址类型、选项 pf(协议族)或地址格式指定版本时。如果名称解析未返回匹配的条目,则会选择第一个结果(具有不同的 IP 版本)。值为 0 时,socat 始终选择第一个记录及其 IP 版本。

SOCAT_MAIN_WAIT (input) SOCAT_MAIN_WAIT(输入)
Specifies the time (seconds) to sleep the main process on begin of main\(). Useful for debugging.
指定主进程在 main\()开始时休眠的时间(秒)。用于调试。

SOCAT_TRANSFER_WAIT (input)
SOCAT_TRANSFER_WAIT(输入)
Specifies the time (seconds) to sleep the process after opening addresses before entering the transfer loop. Useful for debugging.
指定在打开地址后进入传输循环之前进程休眠的时间(秒)。 用于调试。

SOCAT_FORK_WAIT (input) SOCAT_FORK_WAIT(输入)
Specifies the time (seconds) to sleep the parent and child processes after successful fork(). Useful for debugging.
指定成功 fork() 后父进程和子进程休眠的时间(秒)。用于调试。

SOCAT_VERSION (output) SOCAT_VERSION(输出)
Socat sets this variable to its version string, e.g. "1.7.0.0" for released versions or e.g. "1.6.0.1+envvar" for temporary versions; can be used in scripts invoked by socat.
Socat 将此变量设置为其版本字符串,例如发布版本为 "1.7.0.0" ,临时版本为 "1.6.0.1+envvar" ;可在 socat 调用的脚本中使用。

SOCAT_PID (output) SOCAT_PID(输出)
Socat sets this variable to its process id. In case of fork address option, SOCAT_PID gets the child processes id. Forking for exec, system, and SHELL does not change SOCAT_PID.
Socat 将此变量设置为其进程 ID。在 fork 地址选项的情况下,SOCAT_PID 获取子进程的 ID。对于 exec、system 和 SHELL 的分叉不会改变 SOCAT_PID。

SOCAT_PPID (output) SOCAT_PPID(输出)
Socat sets this variable to its process id. In case of fork, SOCAT_PPID keeps the pid of the master process.
Socat 将此变量设置为其进程 ID。在分叉的情况下,SOCAT_PPID 保留主进程的 pid。

SOCAT_PEERADDR (output) SOCAT_PEERADDR(输出)
With passive socket addresses (all LISTEN and RECVFROM addresses), this variable is set to a string describing the peers socket address. Port information is not included.
对于被动套接字地址(所有 LISTEN 和 RECVFROM 地址),此变量设置为描述对等套接字地址的字符串。不包括端口信息。

SOCAT_PEERPORT (output) SOCAT_PEERPORT(输出)
With appropriate passive socket addresses (TCP, UDP, and SCTP - LISTEN and RECVFROM), this variable is set to a string containing the number of the peer port.
通过适当的被动套接字地址(TCP、UDP 和 SCTP - LISTEN 和 RECVFROM),此变量设置为包含对等端口号的字符串。

SOCAT_SOCKADDR (output) SOCAT_SOCKADDR(输出)
With all LISTEN addresses, this variable is set to a string describing the local socket address. Port information is not included example
使用所有的监听地址,此变量设置为描述本地套接字地址的字符串。不包括端口信息示例

SOCAT_SOCKPORT (output) SOCAT_SOCKPORT(输出)
With TCP-LISTEN, UDP-LISTEN, and SCTP-LISTEN addresses, this variable is set to the local port.
对于 TCP-LISTEN、UDP-LISTEN 和 SCTP-LISTEN 地址,此变量设置为本地端口。

SOCAT_TIMESTAMP (output) SOCAT_TIMESTAMP(输出)
With all RECVFROM addresses where address option so-timestamp is applied, socat sets this variable to the resulting timestamp.
在应用地址选项 so-timestamp 的所有 RECVFROM 地址中,socat 将此变量设置为生成的时间戳。

SOCAT_IP_OPTIONS (output)
SOCAT_IP_OPTIONS(输出)
With all IPv4 based RECVFROM addresses where address option ip-recvopts is applied, socat fills this variable with the IP options of the received packet.
当应用了地址选项 ip-recvopts 的所有基于 IPv4 的 RECVFROM 地址时,socat 使用接收到的数据包的 IP 选项填充此变量。

SOCAT_IP_DSTADDR (output)
SOCAT_IP_DSTADDR(输出)
With all IPv4 based RECVFROM addresses where address option ip-recvdstaddr (BSD) or ip-pktinfo (other platforms) is applied, socat sets this variable to the destination address of the received packet. This is particularly useful to identify broadcast and multicast addressed packets.
当应用了地址选项 ip-recvdstaddr(BSD)或 ip-pktinfo(其他平台)的所有基于 IPv4 的 RECVFROM 地址时,socat 将此变量设置为接收到的数据包的目标地址。这对于识别广播和组播地址的数据包特别有用。

SOCAT_IP_IF (output) SOCAT_IP_IF(输出)
With all IPv4 based RECVFROM addresses where address option ip-recvif (BSD) or ip-pktinfo (other platforms) is applied, socat sets this variable to the name of the interface where the packet was received.
当应用了地址选项 ip-recvif(BSD)或 ip-pktinfo(其他平台)的所有基于 IPv4 的 RECVFROM 地址时,socat 将此变量设置为接收数据包的接口名称。

SOCAT_IP_LOCADDR (output)
SOCAT_IP_LOCADDR(输出)
With all IPv4 based RECVFROM addresses where address option ip-pktinfo is applied, socat sets this variable to the address of the interface where the packet was received.
当应用了地址选项 ip-pktinfo 的所有基于 IPv4 的 RECVFROM 地址时,socat 将此变量设置为接收数据包的接口地址。

SOCAT_IP_TOS (output) SOCAT_IP_TOS(输出)
With all IPv4 based RECVFROM addresses where address option ip-recvtos is applied, socat sets this variable to the TOS (type of service) of the received packet.
当应用了地址选项 ip-recvtos 的所有基于 IPv4 的 RECVFROM 地址时,socat 将此变量设置为接收数据包的 TOS(服务类型)。

SOCAT_IP_TTL (output) SOCAT_IP_TTL(输出)
With all IPv4 based RECVFROM addresses where address option ip-recvttl is applied, socat sets this variable to the TTL (time to live) of the received packet.
对于所有基于 IPv4 的 RECVFROM 地址,其中应用了地址选项 ip-recvttl,socat 将此变量设置为接收数据包的 TTL(生存时间)。

SOCAT_IPV6_HOPLIMIT (output)
SOCAT_IPV6_HOPLIMIT(输出)
With all IPv6 based RECVFROM addresses where address option ipv6-recvhoplimit is applied, socat sets this variable to the hoplimit value of the received packet.
当应用了地址选项 ipv6-recvhoplimit 的所有基于 IPv6 的 RECVFROM 地址时,socat 将此变量设置为接收数据包的 hoplimit 值。

SOCAT_IPV6_DSTADDR (output)
SOCAT_IPV6_DSTADDR(输出)
With all IPv6 based RECVFROM addresses where address option ipv6-recvpktinfo is applied, socat sets this variable to the destination address of the received packet.
当应用了地址选项 ipv6-recvpktinfo 的所有基于 IPv6 的 RECVFROM 地址时,socat 将此变量设置为接收数据包的目标地址。

SOCAT_IPV6_TCLASS (output)
SOCAT_IPV6_TCLASS(输出)
With all IPv6 based RECVFROM addresses where address option ipv6-recvtclass is applied, socat sets this variable to the transfer class of the received packet.
对于所有基于 IPv6 的 RECVFROM 地址,其中应用了地址选项 ipv6-recvtclass,socat 将此变量设置为接收数据包的传输类。

SOCAT_OPENSSL_X509_ISSUER (output)
SOCAT_OPENSSL_X509_ISSUER(输出)
Issuer field from peer certificate
对等证书的发行者字段

SOCAT_OPENSSL_X509_SUBJECT (output)
SOCAT_OPENSSL_X509_SUBJECT(输出)
Subject field from peer certificate
对等证书的主题字段

SOCAT_OPENSSL_X509_COMMONNAME (output)
SOCAT_OPENSSL_X509_COMMONNAME(输出)
commonName entries from peer certificates subject. Multiple values are separated by " // ".
对等证书主体中的 commonName 条目。多个值由“ // ”分隔。

SOCAT_OPENSSL_X509_* (output)
SOCAT_OPENSSL_X509_*(输出)
all other entries from peer certificates subject
对等证书主题中的所有其他条目

SOCAT_OPENSSL_X509V3_DNS (output)
SOCAT_OPENSSL_X509V3_DNS(输出)
DNS entries from peer certificates extensions - subjectAltName field. Multiple values are separated by " // ".
对等证书扩展中的 DNS 条目 - subjectAltName 字段。多个值由“//”分隔。

HOSTNAME (input) 主机名(输入)
Is used to determine the hostname for logging (see -lh).
用于确定日志记录的主机名(参见-lh)。

LOGNAME (input) 日志名称(输入)
Is used as name for the socks client user name if no socksuser is given.
如果没有提供 socksuser,则用作 socks 客户端用户名的名称。

With options su and su-d, LOGNAME is set to the given user name.
使用 su 和 su-d 选项时,LOGNAME 设置为给定的用户名。

USER (input) 用户(输入)
Is used as name for the socks client user name if no socksuser is given and LOGNAME is empty.
如果未提供 socksuser 并且 LOGNAME 为空,则用作 socks 客户端用户名的名称。

With options su and su-d, USER is set to the given user name.
使用 su 和 su-d 选项时,USER 被设置为给定的用户名。

SHELL (output) SHELL(输出)
With options su and su-d, SHELL is set to the login shell of the given user.
使用 su 和 su-d 选项,SHELL 被设置为给定用户的登录 shell。

PATH (output) 路径(输出)
Can be set with option path for exec, system, and SHELL addresses.
可以使用 exec、system 和 SHELL 地址的 path 选项进行设置。

HOME (output) 主页(输出)
With options su and su-d, HOME is set to the home directory of the given user.
使用选项 su 和 su-d,HOME 被设置为给定用户的主目录。

CREDITS 鸣谢

The work of the following groups and organizations was invaluable for this project:
以下团体和组织的工作对这个项目非常宝贵:

The FSF (GNU, http://www.fsf.org/) project with their free and portable development software and lots of other useful tools and libraries.
自由软件基金会(GNU,http://www.fsf.org/)项目提供了免费且便携的开发软件以及许多其他有用的工具和库。

The Linux developers community (http://www.linux.org/) for providing a free, open source operating system.
Linux 开发者社区(http://www.linux.org/)提供了一个免费、开源的操作系统。

The Open Group (http://www.unix-systems.org/) for making their standard specifications available on the Internet for free.
The Open Group(http://www.unix-systems.org/)免费在互联网上提供他们的标准规范。

VERSION 版本

This man page describes version 1.8.0 of socat.
本手册描述了 socat 的 1.8.0 版本。

BUGS 错误

Addresses cannot be nested, so a single socat process cannot, e.g., drive ssl over socks.
地址不能嵌套,因此单个 socat 进程不能驱动 ssl 通过 socks。

Address option ftruncate without value uses default 1 instead of 0.
地址选项 ftruncate 如果没有值,则使用默认值 1 而不是 0。

Verbose modes (-x and/or -v) display line termination characters inconsistently when address options cr or crnl are used: They show the data after conversion in either direction.
使用地址选项 cr 或 crnl 时,详细模式 (-x 和/或 -v) 在显示行终止字符时不一致:它们显示转换后的数据在任一方向上。

The data transfer blocksize setting (-b) is ignored with address readline.
使用地址 readline 时,数据传输块大小设置 (-b) 将被忽略。

Send bug reports to <socat@dest-unreach.org>
发送错误报告至 <socat@dest-unreach.org>

SEE ALSO 参见

nc(1), rinetd(8), openssl(1), stunnel(8), rlwrap(1), setsid(1)

Socat home page http://www.dest-unreach.org/socat/
Socat 主页 http://www.dest-unreach.org/socat/

AUTHOR 作者

Gerhard Rieger <rieger@dest-unreach.org> and contributors
Gerhard Rieger <rieger@dest-unreach.org> 和贡献者们