gpt4 book ai didi

c - 我如何在centOS6上获得 `tcp option timestamp`

转载 作者:太空宇宙 更新时间:2023-11-04 12:27:54 25 4
gpt4 key购买 nike

在centOS7上,我可以使用getsockopt(x,IPPROTO_TCP, TCP_TIMESTAMP, x, x)获取tcp时间戳,在netinet/tcp.h中定义了TCP_TIMESTAMP,但是我用centOS6找不到。

那么有没有人在centOS6上成功的呢?非常感谢!

最佳答案

rfc-1323 ,也就是引入tcp timestamp的地方,在第4页,指出:

(3) 往返测量

       TCP implements reliable data delivery by retransmitting
segments that are not acknowledged within some retransmission
timeout (RTO) interval. Accurate dynamic determination of an
appropriate RTO is essential to TCP performance. RTO is
determined by estimating the mean and variance of the
measured round-trip time (RTT), i.e., the time interval
between sending a segment and receiving an acknowledgment for
it [Jacobson88a].

Section 4 introduces a new TCP option, "Timestamps", and then
defines a mechanism using this option that allows nearly
every segment, including retransmissions, to be timed at
negligible computational cost. We use the mnemonic RTTM
(Round Trip Time Measurement) for this mechanism, to
distinguish it from other uses of the Timestamps option.

因此,为连接两端的 TCP 引入的时间戳可以通过将精确的时间戳附加到分段并确定从一侧到另一侧的往返时间来精确确定重传超时间隔。

因此,您看不到获取这些时间戳(或插入它们)的套接字 API 访问是正常的,因为它们与用户空间无关,您无法确定何时放置它们以及何时附加它们到一个段。这些通常出现在 SYN init 段中,以确定初始往返时间,然后随着连接的进行定期确定变化或网络拥塞。

此外,作为在 TCP 协议(protocol)定义之后引入的选项,它被认为是可选的,您可能会遇到不支持它的实现。

关于c - 我如何在centOS6上获得 `tcp option timestamp`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44110724/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com