zoukankan      html  css  js  c++  java
  • tcpip详解笔记(17) TCP的成块数据流

    1. 滑动窗口协议允许发送方在停止并等待确认前可以连续发送多个分组,由于发送方不必每发一个分组就停下来等待确认,因此该方法可以加速数据的传输。

    2. 滑动窗口

    窗口大小表示接收端的TCP协议缓存中还有多少剩余空间,用于接收端的流量控制

    特点:

    (1)发送方不必发送一个全窗口的大小
    (2)来自接收方的一个报文段确认数据并把窗口向右滑动(窗口大小是相对于确认序号的)
    (3)窗口的大小可以减小,但窗口的右边不能向左移动
    (4)接收方在发送一个ACK前不必等待窗口被填满

    窗口更新:一个ACK分组,但不确认任何数据(分组中的序号已被前面的ACK确认),只是通知对方窗口大小已变化

    3. PUSH标志

    发送方使用该标志通知接收方将所收到的数据全部交给接收进程,这标志着发送方暂时没有更多的数据要发送了

    The Push flag, like the Urgent flag, exists to ensure that the data is given the priority (that it deserves) and is processed at the sending or receiving end. This particular flag is used quite frequently at the beginning and end of a data transfer, affecting the way the data is handled at both ends.

    When a host sends its data, it is temporarily queued in the TCP buffer, a special area in the memory, until the segment has reached a certain size and is then sent to the receiver. This design guarantees that the data transfer is as efficient as possible, without waisting time and bandwidth by creating multiple segments, but combining them into one or more larger ones.

    When the segment arrives at the receiving end, it is placed in the TCP incoming buffer before it is passed onto the application layer. The data queued in the incoming buffer will remain there until the other segments arrive and, once this is complete, the data is passed to the application layer that's waiting for it.
    While this procedure works well in most cases, there are a lot of instances where this 'queueing' of data is undesirable because any delay during queuing can cause problems to the waiting application. A simple example would be a TCP stream, e.g real player, where data must be sent and processed (by the receiver) immediately to ensure a smooth stream without any cut offs.

    A final point to mention here is that the Push flag is usually set on the last segment of a file to prevent buffer deadlocks. It is also seen when used to send HTTP or other types of requests through a proxy - ensuring the request is handled appropriately and effectively.

    4. 慢启动

    慢启动为TCP增加一个拥塞窗口(cwnd),刚建立连接时cwnd初始化为一个报文段的大小(由另一端通告),其后每收到一个ACK,cwnd就增加一个报文段大小。发送方取拥塞窗口与通告窗口中的最小值作为发送上限。

    拥塞窗口是发送方使用的流量控制,而通告窗口是接收方使用的流量控制。

    5. URG标志

    紧急标志用于发送端通知接收端分组中包含了紧急数据,具体如何处理由接收方确定

    紧急数据也被成为带外数据

    6. 带宽时延积

    带宽:单位时间内从发送端到接收端所能通过的“最高数据率”
    RTT:从发送端到接收端的一去一回需要的时间
    带宽时延乘积:等于带宽*RTT,实际上就是发送端到接收端单向通道的数据容积的两倍

    设带宽为B,RTT为Tr,滑动窗口为W,则:

    (1)W<B*Tr时,影响TCP发送数据速率的最直接的因素是滑动窗口的大小,TCP的流量控制策略(比如超时时窗口设置为1,重复ACK时窗口减半)最终都是通过控制窗口大小来控制速率,而慢启动,拥塞避免这些流量控制算法实际上就是控制窗口增长方式的算法,也就是控制的是加速度大小。
    (2)当W>B*Tr时,则影响速率的因素是带宽


    参考:
    《TCP/IP详解》
    http://blog.csdn.net/bad_sheep/article/details/6158676
    http://www.cnblogs.com/awpatp/archive/2010/10/04/1841898.html

  • 相关阅读:
    【题解】 bzoj1207: [HNOI2004]打鼹鼠 (动态规划)
    【题解】 bzoj1088: [SCOI2005]扫雷Mine (神奇的做法)
    【题解】 bzoj4472: [Jsoi2015]salesman (动态规划)
    【题解】 bzoj4033: [HAOI2015]树上染色* (动态规划)
    【题解】 [HNOI/AHOI2018]道路 (动态规划)
    炫酷的英文字体分享
    艾伦·麦席森·图灵
    历史上最知名的15位计算机科学家
    浏览器首页被改为2345之解决方法
    linux命令缩写及全称
  • 原文地址:https://www.cnblogs.com/feisky/p/2735475.html
Copyright © 2011-2022 走看看