Figure 9-9. Acknowledging Each Byte
When the server sends the first segment, it starts with a sequence number of 1. However, the sequence number with TCP actually numbers the bytes, not the segments. So, from TCP's perspective, the first byte in the first segment is number 1, and the last byte in the first segment is number 1000. Keith's TCP software sees a sequence number of 1, and sees 1000 total bytes, and decides that the bytes are numbered 1 through 1000.
When TCP at the server builds the second segment, it thinks like this: "The last sequence number was 1, and the segment had 1000 bytes. My next sequence number ought to be 1001 because the last byte in the previous segment was byte number 1000." So, as shown, the server does exactly that. Similarly, the server sends the third segment as sequence number 2001. The last byte of that segment would be number 3000.
Finally, when Keith's TCP software acknowledges the data, it should acknowledge all received data. It received bytes 11000, 10012000, and 20013000 in the three successive TCP segments. Because Keith received all three, without error, Keith's next segment shows an acknowledgement of 3001the next byte he expects to receive.