I'm trying to use netcat
to server some bash
command results via a web interface, that stays running. The page is dynamic and needs to be updated upon loading.
Just an example with what I'm using:
#!/bin/bash
while true; do
{ echo -e 'HTTP/1.1 200 OK\r\n'; echo -e "Hello World"; } |
nc -k -l -p 8888
done
Unfortunately upon loading the page in a web browser, the page just hangs. If I go into CLI and kill the current connection loop, the page will instantly load.
This is happening on 2 servers but is running just fine on another so I'm finding it odd...
-k
option. – Marco Jan 25 '15 at 16:18-k
is dropped, no hangs or other issues. – Marco Jan 25 '15 at 17:12