4 ms·
"requires socat"
by NonEUCitizen 3y ago
"requires socat"
- cf100clunk 3y agoOr cd to the html directory and run this: python -m http.server 8080 which does not require anything else like socat.
- prokopton 3y agoI think this is more of a “ain’t this interesting?” sort of thing.
- cf100clunk 3y agoNot a nawk on awk (pun intended) or socat, just a reply to the parent's comment.
- Brian_K_White 3y agoThis is functional and uninteresting.
- cf100clunk 3y agoFor those who were drawn to ''awk'' in the title it is probably uninteresting. For those who were drawn to ''simple web server'', it is likely of some interest.
- Brian_K_White 3y agoThere are 1000 simple web servers. That part was never interesting to anyone interesting themselves. If it had been "process some records with awk" that too would have been uninteresting even though it said awk.
- sodapopcan 3y ago"requires python"
- CSSer 3y agoWhich in a way is somehow worse :P
- hackideiomat 3y agoin many ways
- cf100clunk 3y agoYes, for some that would be a show-stopper. It is a nice one-line web service string, but should probably be run thusly: nohup python -m http.server 8080 2>/dev/null &
- pmarreck 3y agoNothing is interesting about overrated Python though
- cf100clunk 3y agoUbiquitous, omnipresent, consistently rated in the top 2 or 3 most used computer languages. You don't like it, fine.
- Brian_K_White 3y agoApparently not fine. Are you about to cry?
- deleted 3y ago[deleted]
- keepamovin 3y agoFor tcp. There's another one which uses GAwk's internal tcp stack, but I wasn't sure if that would work in normal awk, and I'm a purist like that so you got this one.
- pmarreck 3y agoI’d like to see both, please
- nine_k 3y agoSocat 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 :-)