socat(1) socat(1) (NAME) socat - ( ) (SYNOPSIS) socat [] <> <> socat -V socat -h[h[h]] | -?[?[?]] filan procan (DESCRIPTION) Socat . ( ) socat . Filan (stdout) . socat . -h . Procan . socat . socat . (init) (logging) . (open) socat . (blocking) socks . (transfer) socat select() socat (newline) . (EOF) (closing) . Socat EOF (shutdown) . socat . (OPTIONS) Socat . . -V . -h | -? . -hh | -?? -h . . -hhh | -??? -hh . -d (fatal) (error) (warning) (notice) . DIAGNOSTICS . -d0 socat 1.7.4 . -d -d | -dd | -d2 . -d -d -d | -ddd | -d3 (info) . -d -d -d -d | -dddd | -d4 (debug) . -D . --experimental . -ly[] stderr syslog -d . syslog "daemon" . . -lf stderr [ ] . libwrap . -ls stderr ( ). libwrap syslog . -lp (override) . -lu (timestamp) . syslog . -lm[] . stderr socat (daemon) ( fork accept) syslog . syslog "daemon" . -lh (hostname) . HOSTNAME HOSTNAME uname() . -v stderr . "> " "< " . -x stderr . "> " "< " . -v . -r () (dump) . $$ ( pid) $PROGNAME ( -lp ) $TIMESTAMP ( %Y%m%dT%H%M%S ) MICROS ( ) . (shell expansion) . -R () (dump) . -r . -b [size_t] . . 8192 . -s socat . socat . socat . -S socat (catch) . socat core dump . SIGHUP SIGINT SIGQUIT SIGILL SIGABRT SIGBUS SIGFPE SIGSEGV SIGTERM (0x89de ) (bitmap) ( SIGFPE 8 0x0080 ). : SIGHUP SIGINT SIGQUIT SIGUSR1 SIGPIPE SIGALRM SIGTERM SIGCHLD . -t EOF (shutdown) . socat [timeval] . 0.5 . . EOF socat . -T : socat [timeval] ( ) . 1.8.0.0 "0" "" 1.8.0.1 "0" 0 (<0) . UDP EOF . -u (unidirectional) . (). -U . . -g . . -L (lockfile) . (unlink) . -W . . -4 IP 4 . 1.8.0.1 . -6 IP 6 . -0 IP (LISTEN RECV ) ( BSD) . --statistics -S socat ( ) . USR1 . . (ADDRESS SPECIFICATIONS) socat . ':' ',' . ( TCP4 OPEN EXEC). ('-' STDIO TCP TCP4). . : FD ( ) ':' ',' '/' GOPEN ( ) . . TCP4 ( ) ( ) . . . '=' . . . . ( -g). (single) . "!!" (dual) . socat . . / . -u -U . . 1.5.0 socat . ( { [ ' - ) } ] ' - . socat : , !! . \ "" (escape) . (ADDRESS TYPES) . CREATE: creat() . (write-only) creat . -u -U . O_LARGEFILE . OPEN create,create . . (named pipe) creat() . : FD,REG,NAMED : mode, mode, user, group, unlink-early, unlink-late, append : OPEN, GOPEN DCCP-CONNECT:: (DCCP::) DCCP [ IP] [ DCCP] IP pf . : FD,SOCKET,IP4,IP6,SCTP,CHILD,RETRY : bind, connect-timeout, tos, dccp-set-ccid, nonblock, sourceport, retry, readbytes : DCCP4-CONNECT, DCCP6-CONNECT, DCCP-LISTEN, TCP-CONNECT SCTP-CONNECT DCCP4-CONNECT:: (DCCP4::) DCCP-CONNECT IPv4 . : FD,SOCKET,IP4,DCCP,CHILD,RETRY DCCP6-CONNECT:: (DCCP6::) DCCP-CONNECT IPv6 . : FD,SOCKET,IP6,DCCP,CHILD,RETRY DCCP-LISTEN: (DCCP-L:) [ DCCP] DCCP . IP pf socat (-4, -6) SOCAT_DEFAULT_LISTEN_IP . . : FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6,DCCP,RETRY : fork, bind, range, max-children, backlog, accept-timeout, dccp-set-sid, su, reuseaddr, retry : DCCP4-LISTEN, DCCP6-LISTEN, TCP-LISTEN, SCTP-LISTEN, DCCP-CONNECT DCCP4-LISTEN: (DCCP4-L:) DCCP-LISTEN IPv4 . : FD,SOCKET,LISTEN,CHILD,RANGE,IP4,DCCP,RETRY DCCP6-LISTEN: (DCCP6-L:) DCCP-LISTEN IPv6 . : FD,SOCKET,LISTEN,CHILD,RANGE,IP6,DCCP,RETRY EXEC: execvp() . . '/' '/' ARGV[0] . execvp() $PATH . socat stdin stdout socketpair() . () : FD,SOCKET,EXEC,FORK,TERMIOS : path, fdin, fdout, chroot, su, su-d, nofork, socktype, pty, stderr, ctty, setsid, pipes, umask, login, sigint, sigquit, netns : SYSTEM,SHELL FD: . (UN*X) . : FD (TERMIOS,REG,SOCKET) : STDIO, STDIN, STDOUT, STDERR GOPEN: ( Generic open) . . . socat socat sendto() . socat O_APPEND . O_CREAT (). : FD,REG,SOCKET,NAMED,OPEN : OPEN, CREATE, UNIX-CONNECT IP-SENDTO:: IP . pf IP . [ IP] . IP . : FD,SOCKET,IP4,IP6 : pf, ttl : IP4-SENDTO, IP6-SENDTO, IP-RECVFROM, IP-RECV, UDP-SENDTO, UNIX-SENDTO INTERFACE: (link level) . . . : FD,SOCKET : pf, type : ip-recv IP4-SENDTO:: IP-SENDTO IPv4 . : FD,SOCKET,IP4 IP6-SENDTO:: IP-SENDTO IPv6 . : FD,SOCKET,IP6 IP-DATAGRAM:
: (broadcast) (multicast) . RANGE TCPWRAP . . : FD, SOCKET, IP4, IP6, RANGE : 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 : IP4-DATAGRAM, IP6-DATAGRAM, IP-SENDTO, IP-RECVFROM, IP-RECV, UDP-DATAGRAM IP4-DATAGRAM:: IP-DATAGRAM IPv4 . () : FD,SOCKET,IP4,RANGE IP6-DATAGRAM:: IP-DATAGRAM IPv6 . IPv6 (broadcast) . : FD,SOCKET,IP6,RANGE IP-RECVFROM: IP . pf IP . . fork - - . UDP ntpd named . IP . IP-SENDTO ( ). IP . RECVFROM . : FD,SOCKET,IP4,IP6,CHILD,RANGE : pf, fork, range, ttl, broadcast : IP4-RECVFROM, IP6-RECVFROM, IP-SENDTO, IP-RECV, UDP-RECVFROM, UNIX-RECVFROM IP4-RECVFROM: IP-RECVFROM IPv4 . : FD,SOCKET,IP4,CHILD,RANGE IP6-RECVFROM: IP-RECVFROM IPv6 . : FD,SOCKET,IP6,CHILD,RANGE IP-RECV: IP . pf IP . . -u -U . socat IP-SENDTO . IP . : FD,SOCKET,IP4,IP6,RANGE : pf, range : IP4-RECV, IP6-RECV, IP-SENDTO, IP-RECVFROM, UDP-RECV, UNIX-RECV IP4-RECV: IP-RECV IPv4 . : FD,SOCKET,IP4,RANGE IP6-RECV: IP-RECV IPv6 . : FD,SOCKET,IP6,RANGE OPEN: open() (). . : . : FD,REG,NAMED,OPEN : creat, excl, noatime, nofollow, append, rdonly, wronly, lock, readbytes, ignoreeof : CREATE, GOPEN, UNIX-CONNECT OPENSSL:: SSL [ TCP] [ IP] TCP/IP pf . : 1.7.2.4 cafile capath IP . 1.7.3.0 socat openssl-commonname . Socat commonName subject DNS subjectAltName . (Wildcard) . : FD,SOCKET,IP4,IP6,TCP,OPENSSL,RETRY : min-proto-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, bind, pf, connect-timeout, sourceport, retry : OPENSSL-LISTEN, TCP OPENSSL-LISTEN: tcp [ TCP] . IP pf . SSL . : certificate . : cafile capath IP ! : FD,SOCKET,IP4,IP6,TCP,LISTEN,OPENSSL,CHILD,RANGE,RETRY : pf, min-proto-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, fork, bind, range, tcpwrap, su, reuseaddr, retry : OPENSSL, TCP-LISTEN OPENSSL-DTLS-CLIENT:: DTLS [ UDP] [ IP] UDP/IP pf . Socat subjectAltName commonName openssl-commonname . (Wildcard) . -b socat . -T . : FD,SOCKET,IP4,IP6,OPENSSL,RETRY : min-proto-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, bind, pf, sourceport, retry, rcvtimeo : OPENSSL-DTLS-SERVER, OPENSSL-CONNECT, UDP-CONNECT OPENSSL-DTLS-SERVER: UDP [ UDP] . IP pf . DTLS . : certificate . : cafile capath IP ! -b socat . -T . : FD,SOCKET,IP4,IP6,LISTEN,OPENSSL,CHILD,RANGE,RETRY : pf, min-proto-version, cipher, verify, commonname, cafile, capath, certificate, key, compress, fork, bind, range, tcpwrap, su, reuseaddr, retry rcvtimeo : OPENSSL-DTLS-CLIENT, OPENSSL-LISTEN, UDP-LISTEN PIPE: . . 1.4.3 socat ( unlink-close ). : () . : socat ( 2.4: ) socat . socat -b 2048 . : FD,NAMED,OPEN : rdonly, nonblock, group, user, mode, unlink-early : unnamed pipe PIPE (unnamed pipe) . . : socat ( 2.4: ) socat . -b 2048 . : FD : named pipe, SOCKETPAIR SOCKETPAIR (socketpair) . . . : FD : socktype : unnamed pipe POSIXMQ-READ:/ POSIX () . . -u -U . Socat POSIX MQ . : posixmq-priority, unlink-early, unlink-close, o-nonblock, o-creat, o-excl, umask POSIXMQ-RECEIVE:/ POSIXMQ-RECV:/ POSIX () . . POSIXMQ-READ . : POSIX MQ recv with fork : posixmq-priority, fork, max-children, unlink-early, unlink-close, o-creat, o-excl, umask POSIXMQ-SEND:/ POSIX () . . POSIXMQ-READ . () : posixmq-priority, posixmq-flush, fork, max-children, unlink-early, unlink-close, o-creat, o-excl, umask POSIXMQ-WRITE:/ POSIXMQ-SEND . POSIXMQ-BIDIRECTIONAL:/mqueue POSIXMQ:/mqueue POSIX / () / . . POSIXMQ-READ POSIXMQ-SEND . PROXY::: TCP/IP pf HTTP CONNECT hostname:port . socat (). HTTP . : FD,SOCKET,IP4,IP6,TCP,HTTP,RETRY : proxyport, ignorecr, proxyauth, resolve, crnl, bind, connect-timeout, mss, sourceport, retry : SOCKS, TCP PTY (pty) master () . slave () pty . (). ptmx openpty ptmx (POSIX). : FD,NAMED,PTY,TERMIOS : link, openpty, wait-slave, mode, user, group : UNIX-LISTEN, PIPE, EXEC, SYSTEM, SHELL READLINE (). STDIO . SCTP-CONNECT:: (stream) SCTP [ IP] [ TCP] IP pf . : FD,SOCKET,IP4,IP6,SCTP,CHILD,RETRY : bind, pf, connect-timeout, tos, mtudiscover, sctp-maxseg, sctp-nodelay, nonblock, sourceport, retry, readbytes : SCTP4-CONNECT, SCTP6-CONNECT, SCTP-LISTEN, TCP-CONNECT SCTP4-CONNECT:: SCTP-CONNECT IPv4 . : FD,SOCKET,IP4,SCTP,CHILD,RETRY SCTP6-CONNECT:: SCTP-CONNECT IPv6 . : FD,SOCKET,IP6,SCTP,CHILD,RETRY SCTP-LISTEN: [ TCP] SCTP . IP pf socat (-4, -6) SOCAT_DEFAULT_LISTEN_IP . . : FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6,SCTP,RETRY : crnl, fork, bind, range, tcpwrap, pf, max-children, backlog, accept-timeout, sctp-maxseg, sctp-nodelay, su, reuseaddr, retry : SCTP4-LISTEN, SCTP6-LISTEN, TCP-LISTEN, SCTP-CONNECT SCTP4-LISTEN: SCTP-LISTEN IPv4 . : FD,SOCKET,LISTEN,CHILD,RANGE,IP4,SCTP,RETRY SCTP6-LISTEN: SCTP-LISTEN IPv6 . : FD,SOCKET,LISTEN,CHILD,RANGE,IP6,SCTP,RETRY SOCKET-CONNECT::: SOCK_STREAM ( man socket(2) ) remote-address . (int) . . remote-address sockaddr sa_family sa_len ( BSD) . -g socat . : FD,SOCKET,CHILD,RETRY : bind, setsockopt, : TCP, UDP-CONNECT, UNIX-CONNECT, SOCKET-LISTEN, SOCKET-SENDTO SOCKET-DATAGRAM:::: ( man socket(2) ) remote-address . (int) . . remote-address sockaddr sa_family sa_len ( BSD) . -g socat . : FD,SOCKET,RANGE : bind, range, setsockopt, : UDP-DATAGRAM, IP-DATAGRAM, SOCKET-SENDTO, SOCKET-RECV, SOCKET-RECVFROM SOCKET-LISTEN::: SOCK_STREAM ( socket(2) ) local-address . int . include . local-address sockaddr sa_family ( BSD) sa_len . -g socat . : FD,SOCKET,LISTEN,RANGE,CHILD,RETRY : setsockopt, setsockopt-listen, : TCP, UDP-CONNECT, UNIX-CONNECT, SOCKET-LISTEN, SOCKET-SENDTO, SOCKET-SENDTO SOCKET-RECV:::: ( socket(2) ) (bind) . . int . include . local-address sockaddr sa_family ( BSD) sa_len . : FD,SOCKET,RANGE : range, setsockopt, setsockopt-listen : UDP-RECV, IP-RECV, UNIX-RECV, SOCKET-DATAGRAM, SOCKET-SENDTO, SOCKET-RECVFROM SOCKET-RECVFROM:::: ( socket(2) ) . . int . include . local-address sockaddr sa_family ( BSD) sa_len . RECVFROM . : FD,SOCKET,CHILD,RANGE : fork, range, setsockopt, setsockopt-listen : UDP-RECVFROM, IP-RECVFROM, UNIX-RECVFROM, SOCKET-DATAGRAM, SOCKET-SENDTO, SOCKET-RECV SOCKET-SENDTO:::: ( socket(2) ) . . int . include . remote-address sockaddr sa_family ( BSD) sa_len . : FD,SOCKET : bind, setsockopt, setsockopt-listen : UDP-SENDTO, IP-SENDTO, UNIX-SENDTO, SOCKET-DATAGRAM, SOCKET-RECV SOCKET-RECVFROM ACCEPT-FD: ( fork) . systemd " inetd" . : (example) : FD, SOCKET, TCP, CHILD, RETRY : fork, range, sourceport, lowport, tcpwrap SOCKS4::: [ IP] [ IPv4] [ TCP] socks IP pf (). : FD,SOCKET,IP4,IP6,TCP,SOCKS4,RETRY : socksuser, socksport, sourceport, pf, retry : SOCKS5, SOCKS4A, PROXY, TCP SOCKS4A::: SOCKS4 socks 4a socks . : FD,SOCKET,IP4,IP6,TCP,SOCKS4,RETRY SOCKS5-CONNECT:::: SOCKS5-CONNECT::: [ IP] [ IPv4] [ TCP] socks TCP . . : FD, SOCKET, IP4, IP6, TCP, CHILD, RETRY : socksport, sourceport, pf, retry : SOCKS5-LISTEN, SOCKS4, SOCKS4A, PROXY, TCP SOCKS5-LISTEN:::: SOCKS5-LISTEN::: [ IP] socks TCP [ TCP] <-listen-host> [ IPv4] . . : FD, SOCKET, IP4, IP6, TCP, CHILD, RETRY : sourceport, pf, retry : SOCKS5-CONNECT, STDERR . -u -U . : FD (TERMIOS,REG,SOCKET) : FD STDIN . -u -U . : FD (TERMIOS,REG,SOCKET) : readbytes : FD STDIO . : FD (TERMIOS,REG,SOCKET) : readbytes : FD STDOUT . -u -U . : FD (TERMIOS,REG,SOCKET) : FD SHELL: ($SHELL) . [] ',' "!!" . socat stdin stdout . : FD,SOCKET,EXEC,FORK,TERMIOS : path, fdin, fdout, chroot, su, su-d, nofork, socktype, pty, stderr, ctty, setsid, pipes, umask, sigint, sigquit : EXEC, SYSTEM SYSTEM: system() . [] ',' "!!" . socat stdin stdout . : FD,SOCKET,EXEC,FORK,TERMIOS : path, fdin, fdout, chroot, su, su-d, nofork, socktype, pty, stderr, ctty, setsid, pipes, umask, sigint, sigquit, netns : EXEC, SHELL TCP:: [ TCP] [ IP] TCP/IP pf . : FD,SOCKET,IP4,IP6,TCP,RETRY : connect-timeout, retry, sourceport, netns, crnl, bind, pf, tos, mtudiscover, mss, nodelay, nonblock, readbytes : TCP4, TCP6, TCP-LISTEN, UDP, SCTP-CONNECT, UNIX-CONNECT TCP4:: TCP IPv4 (). : FD,SOCKET,IP4,TCP,RETRY TCP6:: TCP IPv6 . : FD,SOCKET,IP6,TCP,RETRY TCP-LISTEN: [ TCP] TCP/IP . IP pf socat (-4, -6) SOCAT_DEFAULT_LISTEN_IP . . : FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6,TCP,RETRY : crnl, fork, bind, range, tcpwrap, pf, max-children, backlog, accept-timeout, mss, su, reuseaddr, retry, cool-write : TCP4-LISTEN, TCP6-LISTEN, UDP-LISTEN, SCTP-LISTEN, UNIX-LISTEN, OPENSSL-LISTEN, TCP-CONNECT TCP4-LISTEN: TCP-LISTEN IPv4 (). : FD,SOCKET,LISTEN,CHILD,RANGE,IP4,TCP,RETRY TCP6-LISTEN: TCP-LISTEN IPv6 . : ipv6only : FD,SOCKET,LISTEN,CHILD,RANGE,IP6,TCP,RETRY TUN[:/] TUN/TAP . socat ("wire side") . /dev/net/tun ioctl() . iff-up ! : ("wire sides") Socat UDP TCP nodelay . : FD,NAMED,OPEN,TUN : iff-up, tun-device, tun-name, tun-type, iff-no-pi, netns : ip-recv UDP:: [ UDP] [ IP] UDP/IP pf . UDP `' (end-of-file) . : FD,SOCKET,IP4,IP6 : ttl, tos, bind, sourceport, pf : UDP4, UDP6, UDP-LISTEN, TCP, IP UDP4:: UDP IPv4 . : FD,SOCKET,IP4 UDP6:: UDP IPv6 . : FD,SOCKET,IP6 UDP-DATAGRAM:
: (broadcast) (multicast) . sourceport ( 1.7.4.0 Socat ) RANGE TCPWRAP . . : FD,SOCKET,IP4,IP6,RANGE : 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 : UDP4-DATAGRAM, UDP6-DATAGRAM, UDP-SENDTO, UDP-RECVFROM, UDP-RECV, UDP-CONNECT, UDP-LISTEN, IP-DATAGRAM UDP4-DATAGRAM:
: UDP-DATAGRAM IPv4 ( ). : FD,SOCKET,IP4, RANGE UDP6-DATAGRAM:
: UDP-DATAGRAM IPv6 . : FD,SOCKET,IP6,RANGE UDP-LISTEN: UDP/IP [ UDP] ` '. IP pf . UDP . . : FD,SOCKET,LISTEN,CHILD,RANGE,IP4,IP6 : fork, bind, range, pf : UDP, UDP4-LISTEN, UDP6-LISTEN, TCP-LISTEN UDP4-LISTEN: UDP-LISTEN IPv4 . : FD,SOCKET,LISTEN,CHILD,RANGE,IP4 UDP6-LISTEN: UDP-LISTEN IPv6 . : FD,SOCKET,LISTEN,CHILD,RANGE,IP6 UDP-SENDTO:: [ UDP] [ IP] UDP/IP pf . . . UDP-RECVFROM UDP-RECV socat . UDP-DATAGRAM . : FD,SOCKET,IP4,IP6 : ttl, tos, bind, sourceport, pf : UDP4-SENDTO, UDP6-SENDTO, UDP-RECVFROM, UDP-RECV, UDP-CONNECT, UDP-LISTEN, IP-SENDTO UDP4-SENDTO:: UDP-SENDTO IPv4 . : FD,SOCKET,IP4 UDP6-SENDTO:: UDP-SENDTO IPv6 . : FD,SOCKET,IP6 UDP-RECVFROM: UDP [ UDP] UDP/IP pf . . fork - - . UDP ntpd named . UDP-SENDTO socat . : . retry forever . UDP-DATAGRAM . : FD,SOCKET,IP4,IP6,CHILD,RANGE : fork, ttl, tos, bind, sourceport, pf : UDP4-RECVFROM, UDP6-RECVFROM, UDP-SENDTO, UDP-RECV, UDP-CONNECT, UDP-LISTEN, IP-RECVFROM, UNIX-RECVFROM UDP4-RECVFROM: UDP-RECVFROM IPv4 . : FD,SOCKET,IP4,CHILD,RANGE UDP6-RECVFROM: UDP-RECVFROM IPv6 . : FD,SOCKET,IP6,CHILD,RANGE UDP-RECV: UDP [ UDP] UDP/IP pf . . . UDP-SENDTO socat syslog . -u -U . : fork UDP-RECVFROM ( -u) . : FD,SOCKET,IP4,IP6,RANGE : pf, bind, sourceport, ttl, tos : UDP4-RECV, UDP6-RECV, UDP-SENDTO, UDP-RECVFROM, UDP-CONNECT, UDP-LISTEN, IP-RECV, UNIX-RECV UDP4-RECV: UDP-RECV IPv4 . : FD,SOCKET,IP4,RANGE UDP6-RECV: UDP-RECV IPv6 . : FD,SOCKET,IP6,RANGE UDPLITE-CONNECT:: UDPLITE4-CONNECT:: UDPLITE6-CONNECT:: UDPLITE-DATAGRAM:
: UDPLITE4-DATAGRAM:
: UDPLITE6-DATAGRAM:
: UDPLITE-LISTEN: UDPLITE4-LISTEN: UDPLITE6-LISTEN: UDPLITE-SENDTO:: UDPLITE4-SENDTO:: UDPLITE6-SENDTO:: UDPLITE-RECVFROM: UDPLITE4-RECVFROM: UDPLITE6-RECVFROM: UDPLITE-RECV: UDPLITE4-RECV: UDPLITE6-RECV: UDPLITE UDP UDP-Lite UDPLITE . UNIX-CONNECT: . . : FD,SOCKET,NAMED,RETRY,UNIX : bind : UNIX-LISTEN, UNIX-SENDTO, TCP UNIX-LISTEN: . . (bind) ( unlink-early !). . 1.4.3 socat ( unlink-close ) (). : FD,SOCKET,NAMED,LISTEN,CHILD,RETRY,UNIX : fork, umask, mode, user, group, unlink-early : UNIX-CONNECT, UNIX-RECVFROM, UNIX-RECV, TCP-LISTEN UNIX-SENDTO: [] . . (bind) ( /tmp/sock1 ). UNIX-RECVFROM UNIX-RECV socat . : FD,SOCKET,NAMED,UNIX : bind : UNIX-RECVFROM, UNIX-RECV, UNIX-CONNECT, UDP-SENDTO, IP-SENDTO UNIX-RECVFROM: [] . . fork - - . UNIX-SENDTO socat . : FD,SOCKET,NAMED,CHILD,UNIX RECVFROM . : fork umask : UNIX-SENDTO, UNIX-RECV, UNIX-LISTEN, UDP-RECVFROM, IP-RECVFROM UNIX-RECV: [] . . -u -U . UNIX-SENDTO socat . syslog . : FD,SOCKET,NAMED,UNIX : umask : UNIX-SENDTO, UNIX-RECVFROM, UNIX-LISTEN, UDP-RECV, IP-RECV UNIX-CLIENT: [] . . : FD,SOCKET,NAMED,UNIX : bind : UNIX-CONNECT, UNIX-SENDTO, GOPEN VSOCK-CONNECT:: VSOCK [VSOCK cid] [VSOCK port] . : FD,SOCKET,CHILD,RETRY : bind, connect-timeout, retry, readbytes : VSOCK-LISTEN, VSOCK-LISTEN: [VSOCK port] VSOCK . . : FD,SOCKET,LISTEN,CHILD,RETRY : fork, bind, max-children, backlog, su, reuseaddr, retry : VSOCK-CONNECT ABSTRACT-CONNECT: ABSTRACT-LISTEN: ABSTRACT-SENDTO: ABSTRACT-RECVFROM: ABSTRACT-RECV: ABSTRACT-CLIENT: ABSTRACT UNIX . "\0" . () . UNIX ABSTRACT NAMED . : netns (ADDRESS OPTIONS) . . (option groups) . . ( -g ). . "=value" value . sync O_SYNC open() . `ttl=value' setsockopt(fd, SOL_IP, IP_TTL, value, sizeof(int)) . socat `crnl' . su-d ( substuser-delayed) chroot() . () . socat (option phase) . ( unlink unlink-early unlink-late) . . setsockopt() . open() . . Socat libc . . . xio.help . FD (file descriptor) (UN*X) . socat . : . . ( ) . cloexec[=] FD_CLOEXEC fcntl() . exec() . Socat . setlk[=] fcntl(fd, F_SETLK, ...) (discretionary) . . "S" (g-x,g+s) "mand" (mandatory) . setlkw[=] fcntl(fd, F_SETLKW, ...) . . setlk . setlk-rd[=] fcntl(fd, F_SETLK, ...) . . setlk . setlkw-rd[=] fcntl(fd, F_SETLKW, ...) . . setlk . flock-ex[=] flock(fd, LOCK_EX) (advisory) . Socat . flock-ex-nb[=] flock(fd, LOCK_EX|LOCK_NB) . . flock-sh[=] flock(fd, LOCK_SH) . Socat . flock-sh-nb[=] flock(fd, LOCK_SH|LOCK_NB) . . lock[=] . setlk flock . POSIX setlkw . user= () . NAMED socat chown() ( !). socat fchown() . (root) . user-late= fchown() . . group= . NAMED socat chown() ( !). socat fchown() . (root) . group-late= fchown() . . mode= [mode_t] ( ) . NAMED open() creat() . NAMED socat chmod() ( !). socat fchmod() . (root) . : umask . umask . perm-late= fchmod() [mode_t] . . append[=] . OPEN socat O_APPEND open() (). socat fcntl(fd, F_SETFL, O_APPEND) . nonblock[=] . connect() TCP . OPEN socat O_NONBLOCK open() . socat fcntl(fd, F_SETFL, O_NONBLOCK) . binary[=] (Cygwin). text[=] (Cygwin). noinherit[=] (Cygwin). cool-write[=] EPIPE ECONNRESET notice error . socat . fork socat 0 . children-shutup . end-close[=] ( ) . (). shutdown(2) . close(2) . EXEC SYSTEM socat . . shut-none[=] (shutdown) ( ) . shut-down[=] ( ) shutdown(fd, SHUT_WR) . . shut-close[=] ( ) close(fd) . shut-null[=] EOF ( ) socat EOF . UDP . netcat socat null-eof . null-eof[=] socat ( ) . socat EOF ( shut-null ). ioctl-void= ioctl() request NULL . ioctl socat . ioctl-int=: ioctl() request (integer) . ioctl-intp=: ioctl() request . ioctl-bin=: ioctl() request . . ioctl-string=: ioctl() request . . NAMED . bind /. user group mode . user-early= () chown() . (root) . group-early= chown() . (root) . perm-early= [mode_t] chmod() . (root) . unlink-early[=] user-early (unlink) . unlink[=] user-early (unlink) . unlink-late[=] (unlink) . unlink-close[=] . pty (1) (0) . 1 0 . 1 . OPEN OPEN open() . `creat' O_CREAT . open() ( STDIO) fcntl(..., F_SETFL, ...) . append nonblock . creat[=] (). dsync[=] write() (metainfo) . excl[=] creat . largefile[=] 2^31 . noatime[=] O_NOATIME . noctty[=] . nofollow[=] . nshare[=] . rshare[=] . rsync[=] write() . sync[=] write() . rdonly[=] . wronly[=] . trunc[=] 0 ( ). REG BLK . seek= lseek(fd, , SEEK_SET) ( lseek64 ) [off_t off64_t] . 1 0. seek-cur= lseek(fd, , SEEK_CUR) ( lseek64 ) [off_t off64_t] ( 0 ) . 1 0. seek-end= lseek(fd, , SEEK_END) ( lseek64 ) [off_t off64_t] . 1 0. ftruncate= ftruncate(fd, ) ( ftruncate64 ) [off_t off64_t] . 1 0. secrm[=] unrm[=] compr[=] fs-sync[=] immutable[=] fs-append[=] nodump[=] fs-noatime[=] journal-data[=] notail[=] dirsync[=] ( ext2fs xfs reiserfs) . man 1 chattr . . PIPE (fifos) . f-setpipe-sz= setpipe= . . write() . . . chdir= cd= . . . umask= umask [mode_t] . . '0' . umask . : umask : umask=0026 0640 . PROCESS . EXEC SYSTEM LISTEN CONNECT fork socat . chroot= chroot() (). (root) . chroot-early= chroot() . (root) . setgid= . (root) . . setgid-early= setgid . setuid= () . (root) . . su . setuid-early= setuid . su= () (). (root) . su-d= substuser-delayed. () (). chroot() . (root) . setpgid= . 0 1 . setsid (session) (). netns= . ( TCP ). (root) --experimental . READLINE readline ( BUGS ). readline . history= (history) / (). noprompt 1.4.0 socat (prompt) readline . socat readline . noecho= . readline . (regex) "^[Pp]assword:.*$" "([Uu]ser:|[Pp]assword:)". regex(7) . () prompt= readline . readline . socat . APPLICATION . "" socat PROXY . cr / NL ('\n', 0x0a) / CR ('\r', 0x0d) . crnl / NL ('\n', 0x0a) / CRNL ("\r\n", 0x0d0a) (). : socat CR . ignoreeof (EOF) socat ( "tail -f") (). readbytes= socat ( EOF ). 0 . lockfile= . (unlink) . waitlock= . . escape= (EOF) . (). SOCKET IP . setsockopt() . bind= bind() (bind) . : IP4 IP6 [hostname|hostaddress][:(service|port)] () VSOCK [cid][:(port)] . : unix-bind-tempname connect-timeout= [timeval] . so-bindtodevice= (bind) . (root) . broadcast . debug . dontroute . keepalive (keepalive) . linger= shutdown() close() [int] . oobinline (out-of-band) . priority= [] . rcvbuf= socket() [int] . TCP . rcvbuf-late= [int] . TCP . so-rcvtimeo=