在Linux/Mac/Windows上,是否可以访问已连接TCP套接字的用户空间中的TCP时间戳和/或RTT?

在Linux/Mac/Windows上,是否可以访问已连接TCP套接字的用户空间中的TCP时间戳和/或RTT?,c,sockets,tcp,C,Sockets,Tcp,在Linux/Mac/Windows上,是否可以访问已连接TCP套接字的用户空间中的TCP时间戳和/或RTT?我指的是由启用的TCP时间戳和相关RTT计算。显然,我可以使用原始套接字,但该套接字在Windows上既不能连接也不能发送TCP数据包(我相信是XP Update 3之后的版本)。在Windows上(EstatsType=TcpConnectionEstatsFinett): 在Linux上(tcp\u info.tcpi\u rtt): 在Mac上(xtcpcb64.t_srtt

在Linux/Mac/Windows上,是否可以访问已连接TCP套接字的用户空间中的TCP时间戳和/或RTT?我指的是由启用的TCP时间戳和相关RTT计算。显然,我可以使用原始套接字,但该套接字在Windows上既不能连接也不能发送TCP数据包(我相信是XP Update 3之后的版本)。

在Windows上(EstatsType=TcpConnectionEstatsFinett):

在Linux上(tcp\u info.tcpi\u rtt):

在Mac上(xtcpcb64.t_srtt):
在Windows上(EstatsType=tcpConnectionEstatsFinett):

在Linux上(tcp\u info.tcpi\u rtt):

在Mac上(xtcpcb64.t_srtt):

我想附加更多信息

对于iOS/MacOSX,我发现了另一种与
LinuxTCP\uInfo
非常相似的方法。它是
struct tcp\u connection\u info
。您可以在iOS/MacOSX xcode sdk的
usr/include/netinet/tcp.h
中找到它。您可以按以下方式使用它:

int length = sizeof(struct tcp_connection_info);  
getsockopt(socket_fd, IPPROTO_TCP, TCP_CONNECTION_INFO, (void *)info, (socklen_t *)&length);

我在iOS 10.2上测试了它

我想附加更多信息

对于iOS/MacOSX,我发现了另一种与
LinuxTCP\uInfo
非常相似的方法。它是
struct tcp\u connection\u info
。您可以在iOS/MacOSX xcode sdk的
usr/include/netinet/tcp.h
中找到它。您可以按以下方式使用它:

int length = sizeof(struct tcp_connection_info);  
getsockopt(socket_fd, IPPROTO_TCP, TCP_CONNECTION_INFO, (void *)info, (socklen_t *)&length);

我在iOS 10.2上测试了它

与Linux和OSX不同,Windows上可以使用GetPertCPConnectionStats,但首先需要管理员访问才能启用扩展统计信息。不幸的是,Windows上可以使用GetPertCPConnectionStats,但首先需要管理员访问才能启用扩展统计信息,不幸的是,与Linux和OSX不同。