Back to Transport Layer

TCP Flow Control

Connection management, handshake, and reliable data transfer

Connection Type

Connection-oriented, reliable

Flow Control

Sliding window protocol

Reliability

Guaranteed delivery & ordering

TCP Connection Control

Connection State
CLOSED
Client SEQ: 1000
Server SEQ: 2000
Client ACK: 0
Server ACK: 0

TCP Packet Flow

No packets sent yet. Start with the Three-Way Handshake.

TCP Header Structure

Bits0-1516-31
0-31Source PortDestination Port
32-63Sequence Number
64-95Acknowledgment Number
96-127Header Length + FlagsWindow Size
128-159ChecksumUrgent Pointer
160+Options & Data

TCP Characteristics

Advantages

  • • Guaranteed reliable delivery
  • • Ordered data transmission
  • • Flow control mechanism
  • • Congestion control
  • • Error detection and correction
  • • Full-duplex communication

Disadvantages

  • • Higher overhead (20+ byte header)
  • • Connection setup latency
  • • More complex implementation
  • • Slower than UDP
  • • Not suitable for real-time apps
  • • Connection state maintenance

Common TCP Use Cases

Web Browsing (HTTP/HTTPS)

Reliable delivery of web pages and resources

File Transfer (FTP/SFTP)

Ensures complete and accurate file transfers

Email (SMTP/POP3/IMAP)

Reliable email transmission and retrieval

Remote Access (SSH/Telnet)

Secure and reliable remote terminal access

Database Connections

Reliable data transactions and queries

API Communications

Reliable REST and web service communications