我现在的理解,在有以下两种场合,tcp会把ack包发出去:
1.收到1个或多个包,还没有发ack确认过,正好要给对方发点内容,
  比如要发实际数据,或者要发窗口大小更新包等。
  于是对这1个或多个包的确认ack就跟着捎过去。这叫做“捎带发送”。2.收到1个或多个包,还没有发ack确认过,这时200ms的定时器到点了,
  于是对这1个或多个包的确认ack也会被发送。这叫做“延迟发送”。但是在《tcp/ip详解:卷一》里面,第210页的图20-1给的一个数据传输的时序图例子
好像有个地方跟上面两点不符合。
该例子是由主机serv4向主机bsdi发8个1024字节的数据,bsdi接受到数据后丢弃数据。
第1,2,3个包是握手。第4,5,6个是发过去3个包。7是确认4,5包的ack包,
8是确认第6个包。
按书上的描述,先处理4,标记有一个包未确认,再处理5,变成有两个包未确认,
于是发了一个确认ack包(即第7个包)来确认4和5。
接下来处理6,标记有一个包未确认,然后发生200ms定时器触发,于是再发出一个确认包8。我现在的问题是,第7个包为什么被发出去?
它好像既不是被捎带,也不是发生延迟中断,是否还有其他场合,会发出ack包?

解决方案 »

  1.   

    安装个sniffer,自己上个网站,用sniffer抓包,看看其中的ACK包都在那里出现。
    我的印象,ACK基本上就是用来维持TCP连接的。
      

  2.   

    现在是看到了ack包,不知道为什么被发出来了。
      

  3.   

    在数据通讯阶段,TCP协议对收到的每一个数据报都要进行ACK确认,否则对方会超时重传。
      

  4.   

    Rules for Generating ACK (1)
    1. When one end sends a data segment to the other end, it must include an ACK.  That gives the next sequence number it expects to receive. (Piggyback)
    2. The receiver needs to delay sending (until another segment arrives or 500ms) an ACK segment if there is only one outstanding in-order segment. It prevents ACK segments from creating extra traffic.
    3. There should not be more than 2 in-order unacknowledged segments at any time. It prevent the unnecessary retransmission
    4. When a segment arrives with an out-of-order sequence number that is higher than expected, the receiver immediately sends an ACK segment announcing the sequence number of the next expected segment. (for fast retransmission)
    5. When a missing segment arrives, the receiver sends an ACK segment to announce the next sequence number expected.
    6. If a duplicate segment arrives, the receiver immediately sends an ACK.
    =====================================================================================================以上出自tcp/ip PROTOCIOL SUITE  TCP那一张的 error control中的 ACK生成部分生成 ACK的 规则可以 分为以上6个方法,,,,也许你 看的那本书没有介绍到 一下4中方法,,仅供参考