What is TCP?

The Transmission Control Protocol (TCP) is one of the core protocols of the Internet Protocol Suite. It provides reliable, ordered, and error-checked delivery of data between applications running on hosts communicating via an IP network.

Key Features

Reliable Delivery

TCP ensures that all data sent is received correctly and in order through acknowledgments and retransmissions.

Connection-Oriented

Establishes a connection between sender and receiver before data transmission begins.

Flow Control

Manages the rate of data transmission to prevent overwhelming the receiver.

Error Detection

Uses checksums to detect corrupted data and request retransmission when needed.

Three-Way Handshake

TCP uses a three-way handshake to establish connections:

  1. SYN: Client sends synchronization request to server
  2. SYN-ACK: Server acknowledges and sends its own synchronization
  3. ACK: Client acknowledges server's synchronization

This process ensures both parties are ready to communicate and establishes initial sequence numbers.

TCP Header Structure

The TCP header contains essential information for reliable communication:

  • Source/Destination Ports: Identify sending and receiving applications
  • Sequence Number: Orders data segments
  • Acknowledgment Number: Confirms received data
  • Window Size: Flow control mechanism
  • Checksum: Error detection
  • Flags: Control connection state (SYN, ACK, FIN, RST, etc.)

Modern Relevance

TCP remains fundamental to internet infrastructure:

  • Web Traffic: HTTP/HTTPS rely on TCP for reliable web page delivery
  • Email: SMTP, POP3, and IMAP use TCP for message transmission
  • File Transfer: FTP and SFTP depend on TCP's reliability
  • Cloud Services: Most API communications use TCP-based protocols
  • Database Connections: SQL and NoSQL databases typically use TCP

TCP in AWS Architecture

Understanding TCP is crucial for AWS solutions architects:

  • Load Balancers: ALB and NLB handle TCP connections and health checks
  • Security Groups: Configure TCP port access for EC2 instances
  • VPC Design: TCP traffic flows through subnets and route tables
  • Database Connectivity: RDS and other databases use TCP connections
  • Monitoring: CloudWatch tracks TCP connection metrics