1 (edited by kirschwasser 2013-08-17 10:18:15)

Topic: netcat http-server

Tho following

while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; cat /tmp/index.html; } | nc -l 8080; done

gives

nc: bad address '-l'

with busybox-nc

and

Error: Couldn't resolve host "8080"

with original nc (opkg install netcat)

But on my desktop it works....


Here is the wiki-entry: netcat/busybox-netcat as web server on OpenWrt

Re: netcat http-server

Busybox nc does not support server mode and the full one needs -p before 8080.

Re: netcat http-server

Oh, I just replaced the -l with a -p instead of adding a -p: .... -l -p 8080 works indeed... hrm.

while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; cat /tmp/index.html; } | netcat -l -p 8080; done