`
新来的菜鸟
  • 浏览: 133796 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

What is a TCP window update?

阅读更多

What is a TCP window update?

 

http://stackoverflow.com/questions/1466307/what-is-a-tcp-window-update

 

 

TCP windows are used for flow control between the peers on a connection. With each ACK packet, a host will send a "window size" field. This field says how many bytes of data that host can receive before it's full. The sender is not supposed to send more than that amount of data.

 

The window might get full if the client isn't receiving data fast enough. In other words, the TCP buffers can fill up while the application is off doing something other than reading from it's socket. When that happens, the client would send an ACK packet with the "window full" bit set. At that point, the server is supposed to stop sending data. Any packets sent to a machine with a full window will not be acknowledged. (This will cause a badly behaved sender to retransmit. A well-behaved sender will just buffer the outgoing data. If the buffer on the sending side fills up too, then the sending app will block when it tries to write more data to the socket!)

 

This is a TCP stall. It can happen for a lot of reasons, but ultimately it just means the sender is transmitting faster than the receiver is reading.

 

Once the app on the receiving end gets back around to reading from the socket, it will drain some of the buffered data, which frees up some space. The receiver will then send a "window update" packet to tell the sender how much data it can transmit. The sender starts transmitting it's buffered data and traffic should flow normally.

 

Of course, you can get repeated stalls if the receiver is consistently slow.

I've worded this as if the sender and receiver are different, but in reality, both peers are exchanging window updates with every ACK packet, and either side can have it's window fill up.

The overall message is that you don't need to send window update packets directly. It would actually be a bad idea to spoof one up.

 

Regarding the exception you're seeing... it's not likely to be either caused or prevented by the window update packet. However, if the client is not reading fast enough, you might be losing data. In your server, you should check the return value from your Socket.write() calls. It could be less than the number of bytes you're trying to write. This happens if the sender's transmit buffer gets full, which can happen during a TCP stall. You might be losing bytes.

 

For example, if you're trying to write 8192 bytes with each call to write, but one of the calls returns 5691, then you need to send the remaining 2501 bytes on the next call. Otherwise, the client won't see the remainder of that 8K block and your file will be shorter on the client side than on the server side.

分享到:
评论

相关推荐

    Windows MicroXP 0.82[Microsoft Windows XP SP3原版加工成的微型XP系统,=99.9%个完整XP]

    There you can double click the service you need to use and even a novice user can now read the service descriptions and decide what to enable and what to keep disabled. For example if you have a Dial...

    ramin 2.2 for xp

    the screen update speed is an acceptable 5-10 screen updates per second. If the remote computer is on your LOCAL NETWORK the typical speed is from 100 to 500 screen updates per second. Often while...

    VB编程资源大全(英文源码 网络)

    This could be used for what i used it for in the past for a news program<END><br>28 , url.zip Worldwide list of URL extensions by country<END><br>29 , EmailChk.zip This Application checks for ...

    RealThinClientSDK_v610_BETA

    In older Delphi versions, you will see the "Install" button in the Project Manager window. In newer Delphi versions, you will find the "Install" option if you right-click the package file in the ...

    个性化的E-MAIL软件 Icredimail2001b

    个性化的E-MAIL软件 Icredimail2001b 充满个性化E-MAIL软件,可以选择信纸动画和声音及签名

    《基于YOLOv8的蹦床馆识别系统》(包含源码、完整数据集、可视化界面、部署教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计.zip

    资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。

    MOCD207M 产品规格书

    MOCD207M 丝印D207 SOP8 1.25V 150mA晶体管输出光耦

    2024年迎接上市公司重组并购浪潮推动出版行业企业数字化转型报告.pdf

    2024年迎接上市公司重组并购浪潮推动出版行业企业数字化转型报告

    基于Andorid的闹钟功能设计.zip

    基于Andorid的闹钟功能设计实现源码,主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的学习者,也可作为课程设计、期末大作业。

    电商_微信小程序_学习项目_电商功能演示_1742849441.zip

    电商_微信小程序_学习项目_电商功能演示_1742849441.zip

    《基于YOLOv8的网球发球分析系统》(包含源码、完整数据集、可视化界面、部署教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计.zip

    资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。

    React_应用开发_github-notetaker_实战_1742847797.zip

    app开发

    《基于YOLOv8的隧道安全监测系统》(包含源码、完整数据集、可视化界面、部署教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计.zip

    资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。

    5小时零基础入门小程序云开发-2.7G课程网盘链接提取码下载.txt

    本套课程带领大家零基础入门小程序云开发。摆脱后台自己实现小程序后台,学会音视频小程序的开发,学会小程序图片的上传与管理,学习人工智能识别图片,用小程序模仿微信朋友圈,实现一个云相册。

    移动开发_Android_MVC_调试工具框架BeeFram_1742846880.zip

    移动开发_Android_MVC_调试工具框架BeeFram_1742846880.zip

    vue3-element-admin基础框架带权限参考文档:https://vue3-element-admin-site.midfar.com

    vue3-element-admin基础框架带权限 参考文档:https://vue3-element-admin-site.midfar.com

    《基于YOLOv8的儿童行为监测系统》(包含源码、完整数据集、可视化界面、部署教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计.zip

    资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。

    Python网页文本爬虫:基于小说网站的基础爬虫实现与解析

    内容概要:本文介绍了Python网页文本爬虫的基本概念及其应用,特别是针对小说网站的爬虫实现。文中详细讲解了爬虫的工作原理和技术要点,如urllib库的使用、字符串操作以及正则表达式的初步应用。此外,还提供了完整的爬虫代码示例,涵盖从HTML页面下载到数据提取和处理的全过程。通过对小说网站的具体案例分析,展示了如何利用Python编写简单的爬虫程序来抓取并保存所需信息。 适合人群:对Python编程有一定基础的学习者,尤其是希望了解和掌握网页爬虫技术的初学者。 使用场景及目标:适用于想要快速入门Python爬虫技术的人群,帮助他们理解爬虫的基本原理和实现方法,为后续深入学习打下坚实基础。具体应用场景包括但不限于自动化数据收集、信息检索系统构建等。 其他说明:虽然本文主要关注于基础爬虫的实现,但同时也提到了一些进阶的技术方向,如HTTP长连接和多线程的应用,供有兴趣进一步探索的读者参考。

    jiguang.zip

    jiguang.zip

Global site tag (gtag.js) - Google Analytics