2017-05-22 60 views
0
TCP選項timestamp`

上centOS7,我可以用 getsockopt(x,IPPROTO_TCP, TCP_TIMESTAMP, x, x) 得到TCP時間戳以及TCP_TIMESTAMP在netinet/tcp.h中定義的,但是當我使用centOS6我不能找到它。我怎樣才能得到`在centOS6

那麼有沒有人在centOS6上成功做到這一點? 非常感謝!

回答

0

rfc-1323,這是在TCP時間戳介紹,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的兩側通過將精確的時間戳附加到段並確定從一側到另一側的往返時間,可以精確確定重傳時間間隔。

因此,您看到沒有socket API獲取這些時間戳(或插入它們)是正常的,因爲它們與用戶空間無關,您無法確定何時放置它們以及何時放置它們附加到細分受衆羣。這些通常在SYN初始段中可見,以確定初始往返時間,然後在連接進行時定期確定變化或網絡擁塞。

此外,作爲在TCP協議定義之後引入的選項,它被認爲是可選的,您可能會遇到不支持它的實現。