2 ms·
Socat is a trivial stream converter, like a pipe fitting with different thread sizes on two ends. The interesting part is the logic and the actual.string proce
by nine_k 3y ago
Socat is a trivial stream converter, like a pipe fitting with different thread sizes on two ends.
The interesting part is the logic and the actual.string processing.
- ISL 3y agoMy first interesting question was, "How do I open a port in awk?!"
- bewuethr 3y agoGNU Awk has an entire separate manual for TCP/IP internetworking: https://www.gnu.org/software/gawk/manual/gawkinet/ https://www.gnu.org/software/gawk/manual/gawkinet/
- eichin 3y agoTrue, but you can go the other way and do it with only socat: socat -v tcp-listen:8888,reuseaddr,fork exec:'cat RESPONSE' is a (Very Static) entire web server, if RESPONSE has 2 header lines, a blank, and an html body. (A little too late in the morning for me to do the golfing needed to eliminate the "cat" and do the cr-nl from whatever shell you're already running, though.)
- eichin 3y ago(scrolls down further in the socat manpage) Ohhh, under "EXAMPLES": you can combine a crlf option to TCP-LISTEN, SYSTEM instead of EXEC, and "echo -e", and there's actually a slightly useful http server already done :-)