TCP reliability is implemented with sequence number (Seq #) and acknowledgment number (Ack #) ( as described before) .
If data is missing, retransmission is performed, and RTO Retransmission TimeOut is calculated based on the RTT value.
The RTT(Round Trip Time) value is the time from when data is sent until ack returns, and only one packet is sampled for each Window size.
Moreover, this RTT value is used to calculate the Smooth RTT (SRTT) value. The calculation formula of SRTT value is as follows.
α is recommended 0.9.
The following formula is used for RTO.
In addition, on Windows , RTO = 3 seconds is set as the initial value at TCP connection , and after that the RTO value is updated at the timing of the above sampling.
Also, in Windows, the number of TCP retransmissions is five times according to the registry. If you want to change it, modify the "TcpMaxDataRetransmissions" registry as follows.
- Windows key + R
- Regedit [Enter]
- Follow HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters
- Right click in the right pane, left click with "New" ⇒ "DWORD"
- Set the name to "TcpMaxDataRetransmissions"
- If you want to set the number of retransmissions to 10, set a for hexadecimal and a for decimal 10
- Restart when it becomes as follows
There is a pattern that data is not sent as a pattern missing data, and a pattern that the sent data is incorrect. The checksum is the mechanism that detects errors in the data sent .
The checksum calculation method uses the following pseudo IP header format .
There are three checksum targets. Pseudo IP header, TCP header (replacing the checksum field with 0) and TCP data. We divide these into 16 bit units, calculate 1's complement for each, and sum them. By taking the 1's complement of the total value, 16 bits entering the checksum are determined.
Notice that despite being TCP, the low IP header of the layer is also checked, though it is a part .
In IPv4, we also checksum itself of the IP header itself, and if TCP is used above IP, it means that we double check the IP header.
In IPv6,checksum of the IPv6 header disappeared because of the large number of opportunities to be used with TCP and the low error rate due to the improvement of communication technology . Instead, it is desirable to do this in higher layers, like TCP etc.
For studying TCP / UDP, the following books are recommended.