Sign up ×

What is the simplest way to do the following thing?

Run a program which will open specified port, listen for it, and display whatever it receives. Also if type something -- then send back to connected peer.

This is for debug purposes.

share|improve this question
You can use for the same –  Rahul Patil Jan 2 '13 at 10:08

2 Answers 2

up vote 3 down vote accepted

Server listens on port 8000:

$ nc -l 8000

Client connects to port 8000:

$ nc localhost 8000 
share|improve this answer
This doesn't answer the question. The poster wanted to display what the client sends. The only way I see is to use the "-c" or "-e" option but I'm hoping there's a solution using only pipes. –  user7000 Aug 2 '14 at 3:23

This sounds like a job for Gnu Netcat (nc)

share|improve this answer

Your Answer


