[英]On Linux/Mac/Windows, is it possible to access the TCP timestamp and/or RTT in user space of a connected TCP socket?
[英]How do you get the current RTT estimation for a tcp socket?
特别是在 C 中,用于 *nix 系统。
您可以TCP_INFO
使用特定于 linux 的套接字选项TCP_INFO
(在linux/tcp.h
TCP_INFO
中定义)
struct tcp_info ti;
socklen_t tisize = sizeof(ti);
getsockopt(fd, IPPROTO_TCP, TCP_INFO, &ti, &tisize);
现在 rtt-estimation 在ti.tcpi_rtt
(单位是毫秒)。 还有几个更有趣的值,只需查看结构 tcp_info。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.