I am working on getting the performance parameters of a tcp connection and one these parameters is the bandwidth. I am intending to use the tcp_info
structure supported from linux 2.6 onwards, which holds the meta data about a tcp connection. The information can be retrieved using the getsockopt()
function call on tcp_info
. I have spent lot of time finding a good documentation which explains all the parameters in that structure, but couldn't find one.
Also I tested a small program to retrieve the values from tcp_info
for a tcp connection where I found the measured MSS values for most of the time as zero.To make long story short-Is there a link to follow for which has complete details ontcp_info
and also is it reliable to use these values.
Here is a fairly comprehensive write-up of the structure and use of the linux tcp_info by René Pfeiffer but there are a couple of things worth noting:
- The author needed to look at these data repeated over time because there are no aggregate stats in that structure.
- The author directs you to the tcp.c source as the final authority on the meaning of any of those data.
- I'm not sure what you were hoping to get from the Maximum Segment Size, but expect you thought it meant something else.
If you are truly interested in exact measurements of bandwidth you need to use a measurement device which is outside the system being tested as even pulling the ioctls
will affect the phenomenon you are interested in knowing about. A passive wire sniffer is the only way to get truly accurate results. Finally, depending on your application, "bandwidth" is a really broad umbrella which flattens many measurements (e.g. latency, round-trip-time, variability, jitter, etc.) into one category.