three-way handshake & sequence number

Hex asked:

Looking at the image below, taken from the book of Ilya Grigorik – High Performance Browser Networking, I can understand that the SYN packet picks a random sequence number which is incremented in SYN ACK packet (N+1). Finally, in the ACK packet both sequence (N+1) and acknowledge (N+1) numbers are incremented.

When testing with Wireshark I got the ACK packet to have Acknowledgment number = N+1 but the Sequence number = N. Is this a mistake by the author when he says that in ACK packet both Sequence and Acknowledgment numbers are incremented?

enter image description here

My answer:

RFC 793 states repeatedly that the acknowledgement number is the sequence number of the next packet that end expects to receive. Thus it will always be higher than the sequence number.

For instance, in section 2.6:

Segments also carry an acknowledgment number which is the sequence number of the next expected data octet of transmissions in the reverse direction.

In section 3.1:

Acknowledgment Number: 32 bits

If the ACK control bit is set this field contains the value of the next sequence number the sender of the segment is expecting to receive. Once a connection is established this is always sent.

Section 3.3 explains in detail how the sequence numbers work, and why they work the way they do. You will probably find it much more enlightening than your book.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.