The Problem: Delivery Is Still Not Guaranteed
So far, we have learned:
- Layer 1: moves bits
- Layer 2: delivers frames locally
- Layer 3: routes packets between networks
At this point, packets can travel across the world.
But a huge problem still exists.
Imagine Sending a Book Page by Page
You send a 500-page book by mail.
Each page travels independently.
What could go wrong?
- Page arrive out of order
- Some pages are lost
- Some arrive twice
- Some get damaged
- Receiver doesn't know when book ends
This is exactly how IP works.
Reality of IP (Layer 3)
IP provides:
- Addressing
- Routing
- Best-effort delivery
But IP does NOT guarantee:
- Delivery
- Order
- No duplication
- Reliability
- Speed control
IP simply says:
“I will try my best.”
Applications need much more.
The Need for End-to-End Control
We need a system that ensures:
- Data arrives completely
- Data arrives correctly
- Data arrives in order
- Sender does not overwhelm receiver
- Multiple apps share one connection safely
This responsibility belongs to:
The Tansport Layer (Layer 4)
What the Transport Layer Does
The transport layer provides:
Communication between applications, not just devices.
Layer 3: computer -> computer
Layer 4: application -> application
Example
Your laptop runs:
- Browser
- Spotify
- Email client
All using the Internet simultaneously.
How does data go to the correct application?
Transport layer solves this.
Ports – Talking to the Right Application
Transport layer introduces:
Port Numbers
Think of IP address as a building address.
Ports are apartment numbers.
Example Address
IP: 142.250.183.14
Port: 443Meaning:
- Device = Google server
- Application = HTTPS web service
Common Ports
| Port | Service |
|---|---|
| 80 | HTTP |
| 443 | HTTPS |
| 25 | Email SMTP |
| 53 | DNS |
| 22 | SSH |
Now routers deliver to device.
Transport layer delivers to correct program.
Segmentation – Breaking Data into Pieces
Applications send large data.
Transport layer splits it into segments.
Example:
Large File
↓
Segment 1
Segment 2
Segment 3
...Each segment travels independently.
Later reassembled.
Two Different Philosophies
Transport layer offers TWO communication styles:
- TCP – Reliable
- UDP – Fast
They solve different problems.
TCP (Transmission Control Protocol)
TCP Philosophy
TCP says:
Reliability first.
It guarantees:
- Ordered delivery
- No data loss
- Error recovery
- Congestion control
TCP Connection – The Three-Way Handshake
Before sending data, TCP establishes a connection.
Step 1: SYN
Client -> Server:
“Can we talk?”
Step 2: SYN-ACK
Server -> Client:
“Yes, I am ready.”
Step 3: ACK
Client -> Server:
“Connection established.”
Connection ready.
Reliably Delivery
Every TCP segment has a sequence number.
Receiver sends acknowledgment (ACK):
Received up to byte 5000If sender doesn't receive ACK:
Retransmit data.
Ordering Guarantee
Even if packets arrive:
3 → 1 → 2TCP reorders them:
1 → 2 → 3Application never sees disorder.
Flow Control
Receiver may be slow.
TCP asks:
“How much data can you handle?”
Receiver advertises a window size.
Prevents overload.
Congestion Control (Internet Safety System)
TCP monitors network congestion.
If packets drop:
- Reduce sending speed
- Gradually increase again
This prevents Internet collapse.
Where TCP Is Used
| Application | Why TCP |
|---|---|
| Web browsing | Accuracy required |
| File downloads | No corruption allowed |
| Must be complete | |
| SSH | Reliable control |
UDP (User Datagram Protocol)
UDP Philosophy
UDP says:
Speed over reliability.
No connection.
No guarantees.
Just send.
UDP Characteristics
- Very fast
- Low overhead
- No handshake
- Minimal delay
But:
- No retransmission
- No ordering
- No congestion control
UDP Analogy
TCP = phone call
UDP = shouting messages in a crowd
Where UDP Is Used
| Application | Why TCP |
|---|---|
| Web browsing | Accuracy required |
| File downloads | No corruption allowed |
| Must be complete | |
| SSH | Reliable control |
TCP vs UDP Comparison
| Feature | TCP | UDP |
|---|---|---|
| Connection | Yes | No |
| Reliable | Yes | No |
| Ordered | Yes | No |
| Speed | Slower | Faster |
| Overhead | High | Low |
| Use Case | Accuracy | Real-time |
Leave a comment
Your email address will not be published. Required fields are marked *
