Skip to content
Home » Addressing, Connection Establishment and Release

Addressing, Connection Establishment and Release

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:

  1. Addressing
  2. Connection Establishment
  3. 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 address
  • 80 = 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:

RangeNamePurpose
0–1023Well-known portsCommon services
1024–49151Registered portsRegistered applications/services
49152–65535Dynamic/Private portsUsually temporary client-side ports

Examples

ServicePort
HTTP80
HTTPS443
FTP21
SMTP25
DNS53
SSH22

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:

  1. SYN
  2. SYN + ACK
  3. 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

FeatureConnection EstablishmentConnection Release
PurposeStart communicationEnd communication
TCP mechanismThree-way handshakeUsually four-segment exchange
Main flagsSYN, ACKFIN, ACK
First messageSYNFIN
Number of steps3Normally 4
ResultConnection becomes establishedConnection 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