I am looking for a tool to monitor the quality of a TCP connection. I am trying to describe what I mean:

It should be a tool with a client and a server part. The client sends, say, 1kB of data per second to the server, and the server monitors how fast the packets get delivered.

Or, put otherwise: I am looking for something similar to the "ping" command, except that I can test a TCP connection, and with quite a higher bandwidth (i. e. more packets), e. g. 1kB/s.

I am not interested in maximum throughput, but in constant fast delivery. Like, say, I would stream a 128kps MP3 file over a connection with maximum throughput of also 128kps, but low latency. And I would like to playback that file instantly (or, say, with 1 second buffer).

The goal is to monitor real life usabilty of a network (internet) connection. (And no, I am not interested in something complex to set up and complicated to use like nagios.)

Thank you very much!

  • Hi, Sorry for posting this at stackoverflow.com at first, it is not a programming related question. Please look at my other comments, thank you! – ernesto che Feb 18 '10 at 22:18

How do you define "how fast the packets get delivered" ? If you want to know how much time it takes for a packet to reach point B from point A, then I think it can't be done without sub-millisecond accurate clock synchronization.

What I would try is to capture some real traffic (ie. while actually using your application), and analyze it with WireShark, looking for the delay between some data sent and the corresponding ACK packet. That gives you the round trip time (RTT) for your traffic.


The TCP stack has to keep track of the RTT for each connection. (it's used to optimize packet transmission and manage window size). If you're using Linux, and it's your own application, you can use the getsockopt(fd,.. ,TCP_INFO,...) the data returned includes all this internal parameters. You could peek at this data every second and pipe to a display app.

| improve this answer | |
  • Hi, I am not interested in fine-granular delivery. OK, the problem (from the perspective of the end user is): the internet connections seems not to work sometimes. By "not work" I mean absolutely no response from any server for a period of at least 30 seconds to some minutes, like hickups. And a want to monitor this hickups over long period of time. So I am not looking for some milliseconds of latency, but seconds or even minutes during which no or just very few packets get delivered. – ernesto che Feb 18 '10 at 20:35

Sounds like you need iperf.

However, are you sure you're seeing a non-functional link and not TCP stalls in your users connections? Most TCPs will stall if they see three consecutive packet losses.

Are you using the best TCP congestion control your system has? In Windows, you should turn on Compound TCP if you can, in Linux you should probably be using Westwood for this application.

| improve this answer | |

Just FYI.. Linux 'ping' has this option:

-s packetsize
Specifies the number of data bytes to be sent. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data.

| improve this answer | |

I'm not sure if you're looking for a long-running monitor, or an application like ping for a one-off test. If you want to profile the TCP performance of a link, the classic tool is NetPIPE. NetPIPE can tell you throughput, and the latency of a two-way communication.

| improve this answer | |
  • Hi, thanks for the answer. I want a long-running monitor, but it could also be a shell utility which I would be running in "screen" or pipe the output to a file. Going to look at NetPIPE. – ernesto che Feb 18 '10 at 20:40

For lowest latency, but less error correction, UDP is a better option than TCP (for example with Linux the jackd sound server has a backend that can stream audio over UDP for this very reason - jackd is more oriented to perfect sound quality / pro audio production though).

Check out icecast for UDP mp3 streaming.

| improve this answer | |
  • Looking at your other responses UDP may be harder to deliver to your users ... but maybe you will still have some success with this approach, so I will leave this answer just in case. – Justin Smith Feb 18 '10 at 22:00

In theory is possible to make "passive" monitor. That monitor application TCP data and ACK. and mean channel status as Ok when most Data has corresponding ACK. And only when Data is rare, use active test (ICMP ping, TCP ping). But im dont know such software.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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