Transmission Control Protocol Flashcards
Overview of TCP
TCP is a connection-oriented protocol, meaning it requires a connection to be established before data can be sent. This is achieved through a process known as the “three-way handshake.” TCP is also designed to provide reliable communication. It ensures that data is received in the order it was sent and without any errors. This reliability is achieved through sequence numbers, acknowledgments (ACKs), and checksums.
Key Features of TCP
- Reliable, in-order delivery: TCP rearranges data packets in the order they were sent and manages retransmissions if packets are lost.
Error checking: TCP uses checksums to ensure that data is not corrupted in transit. - Flow control: TCP uses window sizes to control how much data can be sent at a time to ensure that the receiver is not overwhelmed.
- Congestion control: TCP detects congestion in the network and reduces the data transfer rate to alleviate it.
- Connection-oriented: A TCP connection is established before data can be sent, using a three-way handshake.
- Full duplex: Data can flow in both directions simultaneously on the same connection.
TCP Segment Structure:
A TCP segment consists of a header and a data section. The header contains fields like source and destination ports, sequence and acknowledgment numbers, flags, window size, checksum, and urgent pointer.
Sequence and Acknowledgment Numbers:
These numbers are critical for ensuring the orderly and reliable delivery of segments. Sequence numbers are used to number the bytes in a stream of data from sender to receiver, while acknowledgment numbers are used to confirm receipt of data.
Connection Management:
TCP connections are established using a three-way handshake process. This involves:
- SYN: Initiating connection request.
- SYN-ACK: Acknowledgment of the connection request along with the connection request from the other side.
Flow and Congestion Control:
TCP adjusts the rate of data flow based on the network conditions. It uses techniques like sliding windows and congestion avoidance algorithms (like TCP Tahoe, Reno, or New Reno).
Closing a Connection
TCP connections are terminated through a four-way handshake, ensuring that both sides of the connection are cleanly shut down:
One end sends a FIN packet.
The other end acknowledges with an ACK and sends its own FIN.
The original sender completes the termination with a final ACK.