TCP Flow Control & Connection Management
Understand TCP's three-way handshake, data transfer with flow control, and connection termination. Explore sequence numbers, acknowledgments, and window management.
TCP Connection Control
Connection State
CLOSED
Current State:
Client SEQ: 1000
Server SEQ: 2000
Client ACK: 0
Server ACK: 0
Window Size: 1024
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 Len | Reserved | Flags | Window Size |
| 128-159 | Checksum | Urgent Pointer |
TCP Flags
- SYN: Synchronize sequence numbers (connection setup)
- ACK: Acknowledgment field is valid
- FIN: No more data (connection termination)
- RST: Reset the connection
- PSH: Push data to application
- URG: Urgent pointer field is valid
Flow Control Mechanism
- Window Size: Amount of data receiver can accept
- Sliding Window: Allows multiple packets in flight
- Back Pressure: Receiver controls sender's rate
- Zero Window: Receiver buffer is full
- Window Update: Receiver signals buffer space
Exam Important Points
Three-Way Handshake
- 1. SYN: Client sends SYN with initial sequence number
- 2. SYN-ACK: Server responds with SYN+ACK
- 3. ACK: Client acknowledges server's SYN
Purpose: Synchronize sequence numbers and establish connection
Connection Termination
- 1. FIN: Client sends FIN (active close)
- 2. ACK: Server acknowledges FIN
- 3. FIN: Server sends its FIN
- 4. ACK: Client acknowledges server's FIN
Note: Full-duplex closure requires both directions
Common Exam Questions
- • Calculate next sequence/ACK numbers
- • Identify connection states
- • Draw timing diagrams
- • Explain flow control mechanisms
- • Compare TCP vs UDP
- • Calculate effective window size