This causes socat to bind to the multicast group 239.255.1.1 on the interface that has the unicast IP 10.0.0.10, sending and receiving on port 4242 over UDP, reading from stdin and writing to stdout. It basically gives you a simple chat service over the local network.
I remember trying to write a web server that can respond to requests in bash, several years ago. Since it didn't have sockets support that part was going to be handled by netcat. The problem I ended up with was that bash couldn't read and write to the same pipe. The mkfifo solution was the closest that I got to. It turns out that ksh was perfectly capable of reading and writing to the same pipe at that stage. Not long after I got stuck with bash, awk started to support sockets so I used that. Then bash started to support sockets, and many more features, so I suspect it's possible to write a solution in bash now that doesn't need netcat, but might still need a fifo.
On Debian 7.0 (Wheezy) argument "-l 8080" without "-p" causes netcat (v1.10-40) to listen on a random port.
I must run "nc -l -p 8080" to listen at 8080.
[+] [-] WestCoastJustin|12 years ago|reply
[+] [-] gmac|12 years ago|reply
[+] [-] RobAley|12 years ago|reply
http://php.net/manual/en/features.commandline.webserver.php
[+] [-] sprobertson|12 years ago|reply
[+] [-] mikegirouard|12 years ago|reply
[+] [-] unknown|12 years ago|reply
[deleted]
[+] [-] tga|12 years ago|reply
while true; sudo /usr/sbin/apachectl start; break; done;
[+] [-] tga|12 years ago|reply
[+] [-] jiggy2011|12 years ago|reply
[+] [-] general_failure|12 years ago|reply
[+] [-] aprescott|12 years ago|reply
netcat's cool, but the post could've gone a bit further. If it's an intro "how to do this", maybe explain the moving parts for beginners?
[+] [-] unknown|12 years ago|reply
[deleted]
[+] [-] knome|12 years ago|reply
Unless the specified 'index.html' is only readable by root, you don't have to be root to run that.
Only the low ports are restricted from regular users.
[+] [-] anakron|12 years ago|reply
[+] [-] gamegoblin|12 years ago|reply
[+] [-] shurcooL|12 years ago|reply
[+] [-] raldi|12 years ago|reply
[+] [-] jlgreco|12 years ago|reply
[+] [-] mrhazel|12 years ago|reply
[+] [-] lambda|12 years ago|reply
Here's one use I found for it recently, when I wanted to do some experimentation with multicast:
This causes socat to bind to the multicast group 239.255.1.1 on the interface that has the unicast IP 10.0.0.10, sending and receiving on port 4242 over UDP, reading from stdin and writing to stdout. It basically gives you a simple chat service over the local network.[+] [-] hyperair|12 years ago|reply
Works even in an initramfs, and in some embedded systems. Serves up the current directory, and you can even have CGI scripts in cgi-bin.
[+] [-] mcpherrinm|12 years ago|reply
[+] [-] voltagex_|12 years ago|reply
* Side note: if it is, make sure your router manufacturer provides the GPL source release.
[+] [-] kokey|12 years ago|reply
[+] [-] fooyc|12 years ago|reply
That's not what I would call a "server".
[+] [-] lambda|12 years ago|reply
[+] [-] theone|12 years ago|reply
[+] [-] adduc|12 years ago|reply
[+] [-] prezjordan|12 years ago|reply
[+] [-] anonymouz|12 years ago|reply
[1] http://www.home.unix-ag.org/simon/woof.html
[+] [-] human_error|12 years ago|reply
[+] [-] neeee|12 years ago|reply
[+] [-] defap|12 years ago|reply
[+] [-] swirepe|12 years ago|reply
http://www.home.unix-ag.org/simon/woof.html
[+] [-] zerop|12 years ago|reply
[+] [-] amitamb|12 years ago|reply
ruby -run -e httpd . -p 5000
[+] [-] thefox|12 years ago|reply
[+] [-] gcmalloc|12 years ago|reply