窗口扩大选项使TCP的窗口定义从16bit增加到32bit。这并不是通过修改TCP首部来实现的,TCP首部仍然使用16bit,而是通过定义一个选项实现对16bit的扩大操作来完成的。于是TCP在内部将实际的窗口大小维持为32bit的值;

窗口扩大选项的取值范围为0<=shif.cnt<=14;最大值为14的原因如下:

【这段内容为本人理解,非书中原文】TCP需要保留一半的序号用于判断是否是以前的旧数据段,(2^32-1)/2<2^31,也就是现在用于处理新数据段小于2^31个;假如窗口大小为wnd,发送方第一次发送[0,wnd-1]一个窗口的数据,这时接收方收到数据,并统一发送一个ack确认这个窗口的数据,确认完之后,窗口移动准备接收[wnd, 2wnd-1]段的数据;若发送方如果没有收到这个ack,需要重传[0, wnd-1]的数据,若收到了ack,则发送[wnd, 2wnd-1]的数据,这两种情况下,接收方都需要满足序号,也就是序号需要满足2*wnd;前面说了序号的一半用于新数据,也就是2*wnd<2^31,wnd<2^30,即(2^16-1)*2^shif < 2^30,得出shift<=14,即除了TCP首部的16bit,这里最多也就是30-16=14bit;

【这段是找到的RFC原文】大概意思是发送和接收窗口,一个窗口的左边沿到另外一个窗口的右边沿最大不能超过2^31,如果超过这个值就与保留的旧序号重叠了,也就是2*wnd < 2^31,wnd  < 2^30,得出shift<=14;

      RFC1323
TCP determines if a data segment is "old" or "new" by testing
whether its sequence number is within ** bytes of the left edge
of the window, and if it is not, discarding the data as "old". To
insure that new data is never mistakenly considered old and vice-
versa, the left edge of the sender's window has to be at most
** away from the right edge of the receiver's window.
Similarly with the sender's right edge and receiver's left edge.
Since the right and left edges of either the sender's or
receiver's window differ by the window size, and since the sender
and receiver windows can be out of phase by at most the window
size, the above constraints imply that * the max window size
must be less than **, or max window < ** Since the max window is **S (where S is the scaling shift count)
times at most ** - (the maximum unscaled window), the maximum
window is guaranteed to be < * if S <= . Thus, the shift
count must be limited to (which allows windows of ** =
Gbyte). If a Window Scale option is received with a shift.cnt
value exceeding , the TCP should log the error but use
instead of the specified value.

这个选项只能出现在SYN报文段中,因此当连接建立起来后,每个方向上的扩大因子是固定的。为了使用窗口扩大,两端必须在他们的SYN报文段中发送该选项。主动建立连接的一方在其SYN中发送这个选项,但是被动建立连接的一方只能够在接收到带这个选项的SYN之后才可以发送这个选项。每个方向上的扩大因此可以不同;

如果主动连接的一方发送一个非零的扩大因子,但是没有从另一端收到一个扩大选项,它就将发送和接收的移位计数器设置为0。这就允许较新的系统能够与较旧的系统进行互相操作;

假定我们正在使用窗口扩大选项,发送移位计数为S,而接收到的移位计数为R。于是我们从另一端接收到的16bit的通告窗口将被左移R位以获得实际的通告窗口大小。每次当我们向对方发送一个窗口通告的时候,我们将实际的32bit窗口大小右移S位,然后用它来替换TCP首部中的16bit窗口值;

TCP根据接收缓存的大小自动选择位移技术。这个大小是由系统设置的,但是通常向应用程序提供了修改途径;

文章来源: <TCP/IP详解>

TCP窗口扩大选项Window Scale的更多相关文章

  1. TCP窗口扩大选项

    TCP窗口扩大选项(TCP Window Scale Option) TCP窗口扩大选项 TCP Window Scale Option (WSopt) 窗口扩大选项用于扩大TCP通告窗口,使TCP的 ...

  2. TCP 协议中的 Window Size与吞吐量

    原地址:http://blog.sina.com.cn/s/blog_c5c2d6690102wpxl.html TCP协议中影响实际业务流量的参数很多,这里主要分析一下窗口的影响. ​TCP窗口目的 ...

  3. winform错误提示 :窗口类名无效(Window class name is not valid)

    winfrom 程序在 xp 操作系统上报错提示 窗口类名无效(Window class name is not valid) 解决方法 注释 Program类 里 这句 Application.En ...

  4. Android窗口管理服务WindowManagerService显示Activity组件的启动窗口(Starting Window)的过程分析

    文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/8577789 在Android系统中,Activ ...

  5. 机器人局部避障的动态窗口法(dynamic window approach) (转)

    源:机器人局部避障的动态窗口法(dynamic window approach) 首先在V_m∩V_d的范围内采样速度: allowable_v = generateWindow(robotV, ro ...

  6. 学习笔记:javascript 窗口对象(window)

    1.窗口对象属性 属性 描述 closed 返回窗口是否已被关闭. defaultStatus 设置或返回窗口状态栏中的默认文本. document 对 Document 对象的只读引用.请参阅 Do ...

  7. tcp窗口机制(写的最简单精炼的文章)

    tcp窗口机制(写的最简单精炼的文章) http://blog.csdn.net/occupy8/article/details/48468445

  8. 滑动窗口(Sliding Window)技巧总结

    什么是滑动窗口(Sliding Window) The Sliding Problem contains a sliding window which is a sub – list that run ...

  9. 一站式学习Wireshark(五):TCP窗口与拥塞处理

    https://community.emc.com/message/821593#821593 介绍 TCP通过滑动窗口机制检测丢包,并在丢包发生时调整数据传输速率.滑动窗口机制利用数据接收端的接收窗 ...

随机推荐

  1. djang部署vue项目

    1,将vue项目npm run build 在此之前需要修改打包后的js,css文件路径: 需新建vue.config.js 在文件中添加: module.exports = { // 输出目录 as ...

  2. vim insert VISUAL模式无法右键复制问题(转)

    转自:https://blog.csdn.net/coder_oyang/article/details/89096219 vim中使用鼠标右键粘贴,失败.vim的模式: 网上解法: 1. 普通模式下 ...

  3. ado.net 断开 非断开

    非断开 SqlConnection SqlCommand / SqlDataReader 接 断开 SqlConnection SqlDataAdapter / DataSet 接

  4. python eval内置函数作用

    功能:将字符串str当成有效的表达式来求值并返回计算结果. 语法: eval(source[, globals[, locals]]) -> value 参数: source:一个Python表 ...

  5. fastadmin Excel导出时数字被科学计数

    /public/assets/libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min.js //exportOpt ...

  6. Oracle【select from 语句】

    Oracle[select from  语句] 1.select基本功能介绍1)投影操作:结果集是源表中的部分“列”2)选择操作:结果集是源表中的部分“行”3)选择操作+投影操作:结果集是源表中的部分 ...

  7. NB-IOT无线帧结构和下行物理信道

    NB-IOT Downlink OFDM参数 1.下行基于OFDMA, FF点数=128,基带采样速率1.92MHz,子载波间距15kHz,有效带宽180kHz=1PRB OFDMA: 正交频分多址, ...

  8. 一键登录已成大势所趋,Android端操作指南来啦!

    根据极光(Aurora Mobile)发布的<2019年Q2移动互联网行业数据研究报告>,2019年第二季度,移动网民人均安装APP总量已达56款.面对如此繁多的APP,想在用户的手机中占 ...

  9. POJ 1741 单次询问树上距离<=K的点对数 点分治

    #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ; ; ], ...

  10. C++ SQLite的使用总结

    SQLite3简介 SQLite3只是一个轻型的嵌入式数据库引擎,占用资源非常低,处理速度比Mysql还快,专门用于移动设备上进行适量的数据存取,它只是一个文件,不需要服务器进程. SQL语句是SQL ...