I'm using Linux kernel 2.6.32 (x86_64) and can get TCP statistics by passing TCP_INFO
to getsockopt
and receiving a tcp_info
struct, which is defined in /usr/include/netinet/tcp.h
.
Can I get similar statistics for UDP? (possibly fewer because there's no built-in congestion control and retransmission etc. but I'm satisfied with any statistics that I can get)
TCP_INFO literally means info for TCP. The reason there aren't info for UDP is because it's stateless. There's no guaranteed transfer, not rtf, no window size, no much info to provide about.
If you really wanna grab some extra info, take a look at
man 2 recvmsg
, especially this