Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am writing an app for my phone which streams data to a specific port, but I am having problems and looking for a way to listen to a port on my Kubuntu 11.10 machine for incoming traffic. Does anyone know a program which will show me if there is any data coming in on a specific port and how much?

share|improve this question
add comment

3 Answers 3

up vote 3 down vote accepted

A quick and dirty solution can be to use netcat:

nc -l port-number

-l for listening. May need admin privileges for listening on a port number lesser than 1024. Received data will be sent on stdout, so you may need redirection or piping to another command to use the data.

Also, the command should be active before some remote program connect to the port, otherwise the sending program will fail.

For more information, see netcat man page.

share|improve this answer
    
As an alternative you can install and use WireShark. This will help highlight any header information that may be missed or not displayed using NetCat. –  dan_linder Oct 24 '11 at 13:49
add comment

Ettercap will do that for you and plus.

Install it with

sudo apt-get install ettercap

enter image description here

share|improve this answer
add comment

You might want to run a capture script under xinetd. This can also log the connections coming in at start and/or end of the connection.

Your capture script can do whatever you want it to do. It can parse the data if you need or just count the size of the data transmitted.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.