1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-06-06 17:06:05 +02:00
tldr/pages/common/socat.md

29 lines
820 B
Markdown
Raw Normal View History

2016-01-19 17:55:37 +09:00
# socat
2016-01-19 19:53:40 +09:00
> Multipurpose relay (SOcket CAT).
> More information: <http://www.dest-unreach.org/socat/>.
2016-01-19 17:55:37 +09:00
2016-01-20 10:22:04 +09:00
- Listen to a port, wait for an incoming connection and transfer data to STDIO:
2016-01-19 17:55:37 +09:00
`sudo socat - TCP-LISTEN:8080,fork`
2016-01-19 17:55:37 +09:00
2023-09-19 03:49:30 +00:00
- Listen on a port using SSL and print to STDOUT:
`sudo socat OPENSSL-LISTEN:4433,reuseaddr,cert=./cert.pem,cafile=./ca.cert.pem,key=./key.pem,verify=0 STDOUT`
2023-09-19 03:49:30 +00:00
2016-01-19 19:53:40 +09:00
- Create a connection to a host and port, transfer data in STDIO to connected host:
2016-01-19 17:55:37 +09:00
`sudo socat - TCP4:www.example.com:80`
2016-01-19 17:55:37 +09:00
2016-01-20 10:22:04 +09:00
- Forward incoming data of a local port to another host and port:
2016-01-19 17:55:37 +09:00
`sudo socat TCP-LISTEN:80,fork TCP4:www.example.com:80`
2025-01-25 16:44:25 +02:00
- Send data with multicast routing scheme:
`{{echo "Hello Multicast"}} | socat - UDP4-DATAGRAM:{{224.0.0.1}}:{{5000}}`
- Receive data from a multicast:
`socat - UDP4-RECVFROM:{{5000}}`