3

So lets say we want to make a TCP connection with a server

since in TCP we double the sending segments(the number of segments we send or window) after receiving the acks because of tcp congestion control (before reaching the threshold), but does the first segment sent by the sender in the 3 way handshake counts?

Basically what I'm asking is after receiving the ack from receiver in the second phase of 3 way handshake which one these we would do :

1) send the ack only

2) send ack + 1 segment

3) send ack + 2 segment

or maybe non of the above?

  • I think, based on your number 3, that you may be confusing packets and windows. Each packet will hold a single segment. – Ron Maupin Jul 22 '18 at 6:51
  • @RonMaupin sorry i wrote packet instead of segment in some parts of my question, i fixed them now. to be clear I'm only talking about segments in this question. – John P Jul 22 '18 at 9:04
4

Looking at RFC 5681 - TCP Congestion Control

And the definition of the initial window size:

INITIAL WINDOW (IW): The initial window is the size of the sender's congestion window after the three-way handshake is completed.

So, no, the handshake is not taken into account when calculating congestion window size. The initial value of the congestion window is set after the three-way handshake occurs.

The initial window value is bound by the following rules:

IW, the initial value of cwnd, MUST be set using the following guidelines as an upper bound.

  • If SMSS > 2190 bytes:
    • IW = 2 * SMSS bytes and MUST NOT be more than 2 segments
  • If (SMSS > 1095 bytes) and (SMSS <= 2190 bytes):
    • IW = 3 * SMSS bytes and MUST NOT be more than 3 segments
  • if SMSS <= 1095 bytes:
    • IW = 4 * SMSS bytes and MUST NOT be more than 4 segments

Looking at the TCP RFC (793), it is OK for data to be sent during the handshake, but it cannot be delivered to the application until the handshake has completed:

Several examples of connection initiation follow. Although these examples do not show connection synchronization using data-carrying segments, this is perfectly legitimate, so long as the receiving TCP doesn't deliver the data to the user until it is clear the data is valid (i.e., the data must be buffered at the receiver until the connection reaches the ESTABLISHED state). The three-way handshake reduces the possibility of false connections.

So it is possible to send data during the handshake and according to the TCP Congestion Control RFC, the Initial Window has not been set at this stage, so looks like congestion control does not come into play for any data sent during the handshake.

Actual implementations on the other hand may not be true to the RFCs and it is possible that they implement differently.

To answer your final question the final ACK could be sent alone, or with user data, depending on the implementation and whether data was ready to be sent. It would be classed as a single segment though, data or no data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.