TCP Timestamp选项
来源:互联网 发布:未加工数据跑统计模型 编辑:程序博客网 时间:2024/05/16 09:28
Description
Protocol suite: TCP/IP.
Protocol type: Transport layer protocol.
Option length: 10 bytes.
The TCP Timestamp option obsoletes the TCP Echo request and Echo reply options.
RFC 1323:
The timestamps are used for two distinct mechanisms: RTTM (Round Trip Time Measurement)
and PAWS (Protected Against Wrapped Squences).
结构图
Kind. 8 bits. Set to 8.
Length. 8 bits. Set to 10.
Timestamp Value (TSval). 32 bits.
This field contains the current value of the timestamp clock of the TCP sending the option.
TImestamp Echo Reply (TSecr). 32 bits.
This field only valid if the ACK bit is set in the TCP header. If it is valid, it echos a timestamp value
that was sent by the remote TCP in the TSval field of a Timestamps option. When TSecr is not valid,
its value must be zero. The TSecr value will generally be from the most recent Timestamp option
that was received; however, there are exceptions that are explained below. A TCP may send the
Timestamp option in an initial SYN segment(i.e., segment containing a SYN bit and no ACK bit), and
may send a TSopt in other segments only if it received a TSopt in the initial SYN segment for the
connection.
Linux内核中的使用
如果支持Timestamp选项,那么可以用此选项来计算RTT。
static void tcp_ack_saw_tstamp(struct sock *sk , int flag){ /* RTTM Rule: A TSecr value received in a segment is used to * update the averaged RTT measurement only if the segment * acknowledges some new data, i.e., only if it advances the * left edge of the send window. * * Changed: reset backoff as soon as we see the first valid * sample. If we do not, we get strongly overestimated rto. * With timestamps samples are accepted even from very * old segments: f.e., when rtt=1 increases to 8, we retransmit * 5 times and after 8 seconds delayed answer arrives rto * becomes 120 seconds! */ struct tcp_sock *tp = tcp_sk(sk); tcp_valid_rtt_meas(sk, tcp_time_stamp - tp->rx_opt.rcv_tsecr);}
rtt即等于现在的时间tcp_time_stamp减去Timestamp Echo Reply,即tp->rx_opt.rcv_tsecr。
TCP timestamp option的作用:
1)allow more accurate round-trip time measurements for deriving the retransmission
timeout estimator.
2)protect against old segments from the previous incarnations of the TCP connection.
3)allow detection of unnecessary retransmissions.
- TCP Timestamp选项
- TCP Timestamp选项
- 浅析TCP中时间戳选项timestamp
- TCP/IP详解--TCP首部的TimeStamp时间戳选项
- TCP timestamp
- TCP选项详解
- TCP选项之SO_LINGER
- TCP选项之SO_LINGER
- tcp sack选项
- TCP头部选项
- TCP选项优化加速
- TCP SO_KEEPALIVE选项
- TCP之选项TCP_KETEPALIVE
- TCP选项详解
- TCP首部选项介绍
- TCP选项之SO_LINGER
- TCP套接字选项
- TCP选项详解
- 组合模式(Composite Pattern)
- SEO编辑与普通编辑
- C#学习总结
- 根Linux用户管理有关的命令
- 数字证书中keytool命令使用说明
- TCP Timestamp选项
- CXF中could not find matching RPC/Literal part问题处理
- 雷锋网独家特约专访爱秦数码创始人张敏
- 如何找到自己的gmail帐号对应的密码
- Sql server中新建指向orcacle的链接服务器
- 下载 针式PKM V9.08 版
- GXT之旅:第四章:Data与Components(2)——Stroes
- PHP中str_replace函数使用数组
- 一些常用的动态SQL