Simple Socket Server in Bash?

Naftuli Kay picture Naftuli Kay · Jan 19, 2011 · Viewed 91.8k times · Source

Is there a way to quickly bind to a TCP port/ip address and simply print out all information to STDOUT? I have a simple debugging solution which writes things to 127.0.0.1:4444 and I'd like to be able to simply bind up a port from bash and print everything that comes across. Is there an easy way to do this?

Answer

Nikolai Fetissov picture Nikolai Fetissov · Jan 19, 2011
$ nc -k -l 4444 > filename.out

see nc(1)