Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rationale behind ACKs and SEQs?

I am not sure if people find this obvious but I have two questions:

  1. During the 3-way handshake, why is ACK = SEQ + 1 i.e. why am I ACKing for the next byte that I am expecting from the sender?
  2. After the handshake, my ACK = SEQ + len. Why is this different from the handshake? Why not just ACK for the next byte I am expecting as well (the same as during the handshake)?

I know I must've missed out a basic point somewhere. Can someone clarify this?

like image 948
Legend Avatar asked Jan 22 '23 12:01

Legend


2 Answers

This is because the first byte of sequence number space corresponds to the SYN flag, not to a data byte. (The FIN flag at the end also consumes a byte of sequence number space itself.)

like image 172
Matthew Slattery Avatar answered Jan 29 '23 09:01

Matthew Slattery


During the handshake you're synchronizing. The sequence number is the known data. Once you've synced, the data length is the known data as well as a useful pseudo-random verifier. Sender knows how much he sent and if you reply, he assumes you got it. This is easier than reply with, say a checksum or hash of the data, and is usually sufficient.

like image 39
No Refunds No Returns Avatar answered Jan 29 '23 09:01

No Refunds No Returns