netcat, nc, listen to several requests

Posted on


I am trying to debug a network client. I just need to see several HTTP requests made in sequence.

my first idea was o run nc -l 80, but it will keep open the socket after the first connection. Is there a way to run it quickly as a deamon or multithreaded mode? without having to setup inetd or the likes?

my inelegant solution so far is:

while true; do echo 123 | sudo nc -l 80; done

it works but is a pain to kill 🙂

Also you can see there that i do not care at all what is replied to the client. I just want to see the requests coming in without having to install apache/ngix/any more complex script than nc


The simplest solution is probably to do:

sudo python -m SimpleHTTPServer 80

which will return proper HTTP responses to the requests also.

Leave a Reply

Your email address will not be published. Required fields are marked *