Partager via


TCP Selective Acknowledgment

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

Windows Embedded CE introduces support for Selective Acknowledgment, or SACK. SACK is important for good performance, especially for connections using large TCP window sizes. Prior to SACK, a receiver could only acknowledge the latest sequence number of contiguous data that had been received, or the left edge of the receive window. With SACK enabled, the receiver continues to use the ACK number to acknowledge the left edge of the receive window, but it can also acknowledge other blocks of received data individually. SACK uses TCP header options, as shown below. This text was taken directly from RFC 2018:

1. Sack-Permitted Option

This two-byte option may be sent in a SYN by a TCP that has been extended to receive (and presumably process) the SACK option once the connection has opened. It MUST NOT be sent on non-SYN segments.

       TCP Sack-Permitted Option:

       Kind: 4

       +---------+---------+
       | Kind=4  | Length=2|
       +---------+---------+

2. Sack Option Format

The SACK option is to be used to convey extended acknowledgment information from the receiver to the sender over an established TCP connection.

       TCP SACK Option:

       Kind: 5

       Length: Variable

                         +--------+--------+
                         | Kind=5 | Length |
       +--------+--------+--------+--------+
       |      Left Edge of 1st Block       |
       +--------+--------+--------+--------+
       |      Right Edge of 1st Block      |
       +--------+--------+--------+--------+
       |                                   |
       /            . . .                  /
       |                                   |
       +--------+--------+--------+--------+
       |      Left Edge of nth Block       |
       +--------+--------+--------+--------+
       |      Right Edge of nth Block      |
       +--------+--------+--------+--------+

With SACK enabled (the default) a packet or series of packets can be dropped, and the receiver is able to inform the sender of exactly which data has been received, and where the holes in the data are. The sender can then selectively retransmit the missing data without needing to retransmit blocks of data that have already been received successfully. SACK is controlled by the SackOpts registry entry. The trace clip below illustrates a host acknowledging all data up to sequence number 54857341, plus the data from sequence number 54858789 through 54861685.

+ FRAME: Base frame properties
+ ETHERNET: ETYPE = 0x0800 : Protocol = IP:  DOD Internet Protocol
+ IP: ID = 0x1A0D; Proto = TCP; Len: 64
  TCP: .A...., len:0, seq:925104-925104, ack:54857341, win:32722, src:1242  dst:139 
      TCP: Source Port = 0x04DA
      TCP: Destination Port = NETBIOS Session Service
      TCP: Sequence Number = 925104 (0xE1DB0)
      TCP: Acknowledgement Number = 54857341 (0x3450E7D)
      TCP: Data Offset = 44 (0x2C)
      TCP: Reserved = 0 (0x0000)
    + TCP: Flags = 0x10 : .A....
      TCP: Window = 32722 (0x7FD2)
      TCP: Checksum = 0x4A72
      TCP: Urgent Pointer = 0 (0x0)
      TCP: Options
          TCP: Option Nop = 1 (0x1)
          TCP: Option Nop = 1 (0x1)
        + TCP: Timestamps Option
          TCP: Option Nop = 1 (0x1)
          TCP: Option Nop = 1 (0x1)
          TCP: SACK Option
              TCP: Option Type = 0x05
              TCP: Option Length = 10 (0xA)
              TCP: Left Edge of Block  = 54858789 (0x3451425)
   TCP: Right Edge of Block = 54861685 (0x3451F75)

See Also

Concepts

Transmission Control Protocol (TCP)