OpenWrt Forum Archive

Topic: netcat http-server

The content of this topic has been archived on 28 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Tho following

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


nc: bad address '-l'

with busybox-nc


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

(Last edited by kirschwasser on 17 Aug 2013, 12:18)

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

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

The discussion might have continued from here.