TCP prevents loss of data, duplication, and damage. It ensures that the sent message isn't out of order. These characteristics make it a reliable protocol, unlike UDP.
TCP synchronizes using a three-way handshake. Synchronization between two nodes begins when a TCP segment is sent with the SYN
(0x02)
flag set.
TCP sockets are one-to-one. A source node transmits messages to the destination node.
A three-way handshake allows TCP to prevent out-of-order message delivery and duplicated transmission.
SYN
(0x02)
flag is set in a packet and is sent to the destination.SYN
(0x02)
flag and sends an acknowledgement to the source by setting the ACK
(0x10)
flag in the reply. This stage is called SYN-ACK.ACK
segment, which notes that each packet in the TCP messages contains a sequence number to maintain the order.FIN
(0x01)
flag is set in the next reply packet.The sequence numbers allow TCP to control the flow. TCP uses a sliding-window technique. If an ACK
segment is not received in a particular period of time, then it retransmits the missing part of data. However, choosing an appropriate timeout is not an easy task. Therefore, in order to solve this issue, TCP uses adaptive retransmission.
18.119.116.43