Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does TCP's three-way handshake bump the sequence number when acking?

Tags:

tcp

handshake

Why does the TCP three-way handshake bump the sequence number when acking during the initial handshake? How is that better than just leaving the acknowledgement number equal to the sequence number?

The connection is established with

Client sends SYN,A
Server responds with SYN-ACK,A+1,B
Client confirms with ACK,B+1

How is that better than

Client sends SYN,A
Server responds with SYN-ACK,A,B
Client confirms with ACK,B
like image 899
Witness Protection ID 44583292 Avatar asked Oct 10 '22 10:10

Witness Protection ID 44583292


1 Answers

That's because the ACK field means this when the ACK flag is set:

Acknowledgment number (32 bits) – if the ACK flag is set then the value of this field is the next sequence number that the receiver is expecting.

If it is not set to (inital sequence number+1), it would be inconsistently mean both ack'ing the SYN (both SYN and ACK flags must be set in this packet) and saying it is expecting that sequence number again (i.e. hasn't received it).

like image 61
Mat Avatar answered Oct 14 '22 05:10

Mat