TCP 3-way handshake question
So a client starts a TCP connection by sending a SYN packe开发者_运维知识库t to a server with seq. # X. The server then responds with a SYN+ACK for X+1. The same goes for a FIN packet when the close connection protocol is enacted.
So my question is why does the server ACK for X+1 instead of just X? I thought SYN and FIN packets didn't piggyback any data. Is there some other reason for this? I'm confused as to why the server will ACK X+1 instead of X.
The sequence number being sent is the next expected sequence number. If it wasn't incremented, then the reply would indicate that the packet was not accepted, please resend. This would end in an infinite loop.
SYN is a special case that in and of itself transmits information. (It initializes the received count on the destination.) The ACK will be for the next expected byte (SYN + 1).
The ACK count does not always increase, and may increase by more than 1. Consider this exchange where packet 2 is delayed and arrives out of sequence.
Received ACK 1 2 3 2 4 2 2 5
精彩评论