1. Introduction
The Transport Layer is responsible for providing end-to-end communication between applications running on different computers.
A transport protocol such as TCP must perform several important functions to provide reliable communication.
Three important elements are:
- Addressing
- Connection Establishment
- Connection Release
Easy idea:
Addressing → Establish connection → Transfer data → Release connection
2. Addressing
Meaning
At the Transport Layer, communication is not only between two computers. It is between specific applications/processes running on those computers.
Therefore, the transport layer uses a port number to identify an application.
Example
Suppose a computer has:
IP Address: 192.168.1.10
and it is running:
Web Server → Port 80
Email Server → Port 25
The IP address identifies the computer, while the port number identifies the application/service.
Remember:
IP Address → Identifies the computer/device
Port Number → Identifies the application/process
Transport Address
A transport address is generally represented as:
IP Address + Port Number
For example:
192.168.1.10 : 80
Here:
192.168.1.10= IP address80= port number
This combination helps identify the destination application.
Port Numbers
Port numbers are normally 16-bit numbers, ranging from:
0 to 65535
They are commonly divided into:
| Range | Name | Purpose |
|---|---|---|
| 0–1023 | Well-known ports | Common services |
| 1024–49151 | Registered ports | Registered applications/services |
| 49152–65535 | Dynamic/Private ports | Usually temporary client-side ports |
Examples
| Service | Port |
|---|---|
| HTTP | 80 |
| HTTPS | 443 |
| FTP | 21 |
| SMTP | 25 |
| DNS | 53 |
| SSH | 22 |
3. Multiplexing and Demultiplexing
Addressing allows the transport layer to support multiple applications at the same time.
Suppose you are:
- Browsing a website
- Using email
- Downloading a file
at the same time.
The transport layer uses port numbers to keep these communications separate.
Multiplexing
At the sender:
Web Application ──┐
Email Application ├──→ Transport Layer ──→ Network
File Application ─┘
The transport layer combines data from different applications for transmission.
This is called multiplexing.
Demultiplexing
At the receiver:
┌──→ Web Application
Network → Transport ├──→ Email Application
└──→ File Application
The transport layer examines the destination port and delivers data to the correct application.
This is called demultiplexing.
4. Connection Establishment
Meaning
Before reliable data transfer begins, TCP establishes a connection between the sender and receiver.
This process is called connection establishment.
TCP uses a procedure called the:
Three-Way Handshake
5. Three-Way Handshake
The three steps are:
- SYN
- SYN + ACK
- ACK
Diagram
CLIENT SERVER
| |
| -------- SYN --------------> |
| |
| <----- SYN + ACK ----------- |
| |
| -------- ACK --------------> |
| |
| CONNECTION ESTABLISHED |
Step 1: SYN
The client sends a SYN (Synchronize) message to the server.
It means:
“I want to establish a connection with you.”
The client also sends an initial sequence number.
Client → Server
SYN = 1
Sequence Number = X
Step 2: SYN + ACK
The server receives the SYN and responds with:
SYN = 1
ACK = 1
It acknowledges the client’s request and sends its own sequence number.
Server → Client
SYN = 1
ACK = 1
Sequence Number = Y
Acknowledgment = X + 1
It means:
“I received your request, and I am also ready to communicate.”
Step 3: ACK
The client sends an acknowledgment back.
Client → Server
ACK = 1
Acknowledgment = Y + 1
Now the TCP connection is established.
6. Why Three-Way Handshake is Required
The three-way handshake helps TCP:
- Confirm that both sides are reachable.
- Confirm that both sides are ready.
- Synchronize sequence numbers.
- Establish the connection state.
- Prepare both sides for reliable data transfer.
Simple example
It is like making a telephone call:
A: Hello, can you hear me?
B: Yes, I can hear you. Can you hear me?
A: Yes, I can hear you.
Now the conversation can begin.
7. Connection Release
After data transfer is completed, TCP must terminate the connection properly.
This process is called connection release or connection termination.
TCP normally uses a four-segment exchange because each direction of a TCP connection is closed independently.
Diagram
CLIENT SERVER
| |
| -------- FIN --------------> |
| |
| <--------- ACK ------------- |
| |
| <--------- FIN ------------- |
| |
| -------- ACK --------------> |
| |
| CONNECTION CLOSED |
8. Steps of Connection Release
Step 1: FIN
The client sends a FIN (Finish) message.
It means:
“I have finished sending data.”
Client → Server
FIN
Step 2: ACK
The server acknowledges the FIN.
Server → Client
ACK
The server can still send any remaining data if necessary.
Step 3: FIN
When the server has finished sending its data, it sends its own FIN.
Server → Client
FIN
Step 4: ACK
The client sends the final acknowledgment.
Client → Server
ACK
The connection is then closed.
9. Why Four Steps are Normally Used for Release
A TCP connection is full-duplex.
This means:
Client → Server
Server → Client
are independent directions.
Therefore, one side can stop sending while the other side may still have data to send.
For example:
Client: "I have finished sending."
Server: "Okay, I received that, but I still have some data to send."
Therefore, TCP normally uses separate FIN/ACK exchanges for the two directions.
10. Connection Establishment vs Connection Release
| Feature | Connection Establishment | Connection Release |
|---|---|---|
| Purpose | Start communication | End communication |
| TCP mechanism | Three-way handshake | Usually four-segment exchange |
| Main flags | SYN, ACK | FIN, ACK |
| First message | SYN | FIN |
| Number of steps | 3 | Normally 4 |
| Result | Connection becomes established | Connection is terminated |
11. Complete TCP Connection
The overall TCP communication can be represented as:
TCP CONNECTION
CONNECTION ESTABLISHMENT
↓
SYN → SYN+ACK → ACK
↓
DATA TRANSFER
↓
CONNECTION RELEASE
↓
FIN → ACK → FIN → ACK
12. Important Terms
SYN
Synchronize
Used during TCP connection establishment.
ACK
Acknowledgment
Confirms successful receipt of a segment/control message.
FIN
Finish
Used to indicate that a side has finished sending data.
Port Number
Identifies a particular application/process.
IP Address
Identifies the destination/source device at the Internet/Network layer.
13. Easy Example
Suppose your browser wants to connect to a web server.
Client
IP: 192.168.1.10
Port: 50000
|
| TCP connection
↓
Server
IP: 93.184.216.34
Port: 443
Establishment
Client → SYN → Server
Client ← SYN + ACK ← Server
Client → ACK → Server
Data transfer
Client ⇄ TCP Data ⇄ Server
Release
Client → FIN → Server
Client ← ACK ← Server
Client ← FIN ← Server
Client → ACK → Server
14. Addressing + Establishment + Release
For an exam, remember the complete sequence:
┌───────────────┐
│ ADDRESSING │
│ IP + Port │
└───────┬───────┘
↓
┌────────────────────┐
│ CONNECTION │
│ ESTABLISHMENT │
│ SYN → SYN+ACK →ACK │
└────────┬───────────┘
↓
┌────────────────────┐
│ DATA TRANSFER │
└────────┬───────────┘
↓
┌────────────────────┐
│ CONNECTION RELEASE │
│ FIN→ACK→FIN→ACK │
└────────────────────┘
Quick Revision
Addressing
IP + Port = Transport endpoint
Connection Establishment
Three-Way Handshake
SYN → SYN + ACK → ACK
Connection Release
Usually:
FIN → ACK → FIN → ACK
Most important points
- IP address identifies the host.
- Port number identifies the application.
- TCP uses three-way handshake for connection establishment.
- TCP normally uses a four-segment exchange for graceful connection termination.
- SYN is used to establish a connection.
- FIN is used to terminate a connection.
- ACK confirms receipt.
One-line memory trick
Address → Connect → Communicate → Close
