On Linux/Mac/Windows, is it possible to access the TCP timestamp and/or RTT in user space of a connected TCP socket? I'm referring to the TCP timestamp and associated RTT calculation enabled by RFC 1323. Obviously, I could utilize a raw socket, but the socket would neither be connected or capable of sending TCP packets on Windows (post XP Update 3, I believe).
Asked
Active
Viewed 1,753 times
2 Answers
3
I want to append more information.
For iOS/MacOSX, I found another method which is very similar with Linux tcp_info
. It's struct tcp_connection_info
. You can find it in the usr/include/netinet/tcp.h
of the iOS/MacOSX xcode sdk. You can use it as the following:
int length = sizeof(struct tcp_connection_info);
getsockopt(socket_fd, IPPROTO_TCP, TCP_CONNECTION_INFO, (void *)info, (socklen_t *)&length);
I tested it on iOS 10.2.

Jay Zhang
- 109
- 3
- 11
2
On Windows (EstatsType = TcpConnectionEstatsFineRtt):
GetPerTcp6ConnectionEStats
GetPerTcpConnectionEStats
On Linux (tcp_info.tcpi_rtt):
Measuring TCP Congestion Windows (getsockopt)
On Mac (xtcpcb64.t_srtt):
sysctl TCPCTL_PCBLIST to acquire the xtcpcb64 struct
-
`GetPerTcpConnectionEStats` on Windows is possible but requires Administator access to enable the Extended Statistics in the first place, unlike Linux and OSX, unfortunately. – qris Aug 19 '17 at 21:01