2

I have looked through other questions on here involving the relevant topics, but I am still not clear on this.

I have just been reading this explanation of TCP sequence & acknowledgment numbers. About half-way down there is this diagram:

enter image description here

Near the end of the page, the explanation of the final step, step 4, includes this text:

Note that the sequence number of the segment in line 4 is the same as in line 3 because the ACK does not occupy sequence number space.

So keep in mind that any packets generated, which are simply acknowledgments (in other words, have only the ACK flag set and contain no data) to previously received packets, never increment the sequence number.

I am currently struggling to understand this:

  • I can clearly see that the sequence number in the packet sent in step 4 has the same sequence number as the packet sent in step 3.
  • It is also clear to see that the acknowledgement number is also the same in these steps
  • Basically, the author seems to be saying that the step 4 packet is identical to the step 3 packet, except that the step 4 packet contains data/payload.

With regards to my first two points, is this correct?(as in has the author got it right?) With regards to my third point, is this correct? And finally, assuming the answer to the first two questions is basically 'yes', then is the reason that these numbers are the same in both packets because there hasn't been any intervening packet received from the Gateway server?

I am seeking general clarification on this.

1

1 Answer 1

3
  • Yes, sequence number and acknowledgement number in packet 3 and 4 will indeed be identical.
  • No, the packets are not guaranteed to be exactly identical. Differences you might see include:
    • Packet 4 may also have the PSH flag set.
    • If timestamps are in use they could differ between 3 and 4.
    • The checksum will most likely be different.
  • The reason sequence number is the same in packet 3 and 4 is, that packet 3 did not contain any payload data.
  • The reason acknowledgement number is the same in packet 3 and 4 is, that no data was received from the server in the meantime.

Packet 3 is sort of redundant. The TCP layer could decide to wait a few microseconds before sending it and go straight to packet 4, if the application did write something to the socket during those microseconds.

I can recommend using Wireshark to inspect real traffic on your computer, that may help get an idea of what is going on.

2
  • So, basically, does the fact that packet 3 had no payload mean that Gateway server has no need to send back a packet in order to acknowledge(or any other purpose)? (I suppose that would just be like continuing to acknowledge acknowledgments, and where does that end...) and in effect, that Gateway server would only repond with packets either when during 3-way handshake, or having received data?
    – Totem
    May 4, 2014 at 18:59
  • 2
    An ACK is needed in order to let the server know, that the SYN-ACK was received. But there is no need to send the ACK twice, as it happens in the scenario you describe. However the network capacity saved by sending only one packet instead of packet 3 and 4 in the example, may not be enough to justify the additional complexity in the code needed, to figure out if the application is going to send something on the socket immediately. Until the ACK is sent, the application on the server will not be told about the connection, and the server may retransmit the SYN-ACK packet.
    – kasperd
    May 4, 2014 at 19:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .