1

I am interested in getting congestion window size of a connection. The connection is created by another program. I am hoping that we can get this congestion window size using some file in proc, or, there is a call to get this info from kernel...

So I need more leads on any of those approaches ...

nikhilelite
  • 301
  • 1
  • 4
  • 16

2 Answers2

4

If you are on Linux, you can use getsockopt() on the socket using the IPPROTO_TCP socket level and TCP_INFO socket option.

The struct tcp_info structure has the member tcpi_snd_cwnd. A fairly extensive write up can be found here.

FreeBSD also has a similar feature.

Windows provides congestion window information with the GetPerTcpConnectionEStats() call using TcpConnectionEstatsSndCong as the stats type.

jxh
  • 69,070
  • 8
  • 110
  • 193
  • 1
    This is what you can find by searching. And I had already seen it. It seems you did not notice what I asked. I do not own the FD, sock/fd. – nikhilelite Aug 05 '13 at 03:52
  • @nikhilelite: The existence of the system calls means you can implement a kernel module to retrieve such information if you must do it from an external program. – jxh Aug 05 '13 at 06:22
  • Hm, a simple way I found was to just measure sacks and timeouts. each of those causes a cwindow collapse. My approach is going to be use tcpdump to get those events, and calculate cwnd according to it. – nikhilelite Aug 05 '13 at 07:06
  • @nikhilelite: That's not really asking the kernel for the information. But, realize that sometimes the application just didn't have any more information to send, so this would affect how many bytes get sent on the wire as well. – jxh Aug 05 '13 at 16:35
  • I don't really care how we get the window size from kernel. I don't understand your second statement. If the application does not send any data, well then there can be no congestion by definition, which means the size of window will persist. Point is that solution worked, and worked faster than loading/developing klms. – nikhilelite Aug 07 '13 at 00:02
  • @nikhilelite: I don't have a problem with your solution. I was just explaining that using timings based on when data stops flowing may have nothing to do with congestion. But, I read your answer, and you are using more than just timing information, so I think you're fine. – jxh Aug 07 '13 at 00:11
1

My solution was to use tcpdump to capture packet retrans , sack, ecn-cwr. Those indicate that window size will be collapsed, each of those has different collapse magnitudes. But its now just a matter of calculating those magnitudes and pluging them in the initcwnd size.

I think this is easier than what jxh suggested.

nikhilelite
  • 301
  • 1
  • 4
  • 16