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
| Bits | 0-15 | 16-31 |
|---|---|---|
| 0-31 | Source Port | Destination Port |
| 32-63 | Sequence Number | |
| 64-95 | Acknowledgment Number | |
| 96-127 | Header Length + Flags | Window Size |
| 128-159 | Checksum | Urgent 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