8

I am trying to send data to port 2003 I am using tcpflow to listen however i cannot see any data being printed or sent ?

Sending Data to port 127.0.0.1 2003

echo hello | nc localhost 2003 

or

echo "test.count 4 `date +%s`" | nc -q0 127.0.0.1 2003

Listening Data

tcpflow -i lo port 2003
tcpflow: listening on lo 

1 Answer 1

20

Instead of using tcpflow, you should maybe consider using nc instead like this:

nc -l 2003

You are now listening on port 2003. To send data to port 2003, you can open a separate terminal and type:

nc 127.0.0.1 2003

This opens a connection to the listening terminal. Anything you type in that terminal thereafter will be sent to localhost:2003 and will output on the listening terminal. Furthermore, anything typed in the listening port will be sent to the terminal output of the other.

Also, instead of using the second command you can use the same command you tried earlier instead:

echo "hello" | nc 127.0.0.1 2003

The listening terminal should output hello before closing the connection.

For more information, type the following command in a terminal to view the manual:

man nc

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .