简体   繁体   English

我如何在centOS6上获取`tcp option timestamp`

[英]How can I get `tcp option timestamp` on centOS6

on centOS7,I can use getsockopt(x,IPPROTO_TCP, TCP_TIMESTAMP, x, x) to get tcp timestamp, and TCP_TIMESTAMP was defined in netinet/tcp.h, but I can't find it when I use centOS6. 在centOS7上,我可以使用getsockopt(x,IPPROTO_TCP, TCP_TIMESTAMP, x, x)来获取tcp时间戳,并且在netinet / tcp.h中定义了TCP_TIMESTAMP,但是当我使用centOS6时找不到它。

So did anyone do it successfully on centOS6? 那么有人在centOS6上成功做到了吗? Thanks a lot! 非常感谢!

rfc-1323 , which is where tcp timestamp is introduced, in page 4, states: rfc-1323 (在第4页中引入了tcp时间戳记)指出:

(3) Round-Trip Measurement (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.

So, the timestamp introduced there is for TCP's at both sides of a connection could precisely determine the Retransmission TimeOut interval, by attaching precise timestamps to the segments and determine the round trip time from one side to the other. 因此,为连接两端的TCP引入的时间戳可以通过将精确的时间戳附加到段上并确定从一侧到另一侧的往返时间来精确地确定重传超时间隔。

As such, it is normal that you see no socket api access to get these timestamps (or to insert them), as they have nothing to do with user space, you cannot determine when to put them and when they have been attached to a segment. 因此,正常情况下,您看不到获取这些时间戳(或插入它们)的套接字api访问权限,因为它们与用户空间无关,您无法确定何时放置它们以及何时将它们附加到段上。 These are normally seen in the SYN init segment, to determine the initial round trip time, and then periodically, as the connection goes, to determine variations or network congestion. 通常在SYN初始化段中可以看到它们,以确定初始往返时间,然后随着连接的进行,定期确定变化或网络拥塞。

Also, as an option introduced after the TCP protocol definition, it is considered optional, and you can encounter implementations that don't support it. 另外,作为TCP协议定义之后引入的一个选项,它被认为是可选的,您会遇到不支持它的实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM