Connection-Oriented and Connectionless Transport Layer Services

 

Connection-Oriented and Connectionless Transport Layer Services

Introduction

The Transport Layer provides communication between application processes running on different hosts. Depending on the application's requirements, the transport layer can offer two types of services:

  1. Connectionless Service
  2. Connection-Oriented Service

The major difference between these services lies in how packets are handled.

  • In a connectionless service, each packet is treated independently.
  • In a connection-oriented service, packets are treated as part of a continuous communication session (connection).

Unlike the Network Layer, where connection-oriented and connectionless services are related to the physical path taken by packets, the Transport Layer assumes a logical end-to-end connection between the sender and receiver.


Connectionless Transport Service

Definition

A Connectionless Transport Service is a transport-layer service in which each message (or packet) is treated as an independent unit, without establishing a connection between the sender and the receiver.

There is no relationship between consecutive packets.


Characteristics

  • No connection is established before data transfer.
  • Each packet is sent independently.
  • Packets may follow different paths in the network.
  • Packets may arrive out of order.
  • No guarantee of delivery.
  • No acknowledgment mechanism.
  • No retransmission.
  • No flow control.
  • No error control.
  • Very fast due to low overhead.

Working of Connectionless Service

Suppose a client wants to send three message chunks.

Step 1

Application divides the message.

Original Message

↓

Chunk 0

Chunk 1

Chunk 2

Step 2

Transport Layer sends each chunk independently.

Client

Chunk 0

↓

Packet 0

↓

Network


Chunk 1

↓

Packet 1

↓

Network


Chunk 2

↓

Packet 2

↓

Network

There is no coordination among these packets.


Step 3

Packets arrive independently.

Because network delays vary,

they may arrive in the following order.

Packet 0

Packet 2

Packet 1

Step 4

Transport Layer delivers them immediately.

Application Receives

Message 0

Message 2

Message 1

Thus,

the application receives the data out of order.


Illustration

Client Process                      Server Process

Message 0 -----------------------> Message 0

Message 1 ----------------------->

Message 2 -----------------------> Message 2

                                   Message 1

Packet 2 reaches the destination before Packet 1 because there is no dependency between packets.


What Happens if a Packet is Lost?

Suppose

Message 0

Message 1 (Lost)

Message 2

Receiver gets

Message 0

Message 2

Since packets are not numbered, the receiver cannot detect that Message 1 is missing.

The application simply receives incomplete data.




Limitations of Connectionless Service

Since there is no coordination between sender and receiver,

the following mechanisms cannot be effectively implemented:

  • Flow Control
  • Error Control
  • Congestion Control

Advantages

  • Very simple protocol.
  • Low overhead.
  • Faster communication.
  • Suitable for real-time applications.
  • No connection setup delay.

Applications

  • Live audio
  • Live video streaming
  • Online gaming
  • DNS
  • VoIP

UDP (User Datagram Protocol) is the best example of a connectionless transport protocol.


Connection-Oriented Transport Service

Definition

A Connection-Oriented Transport Service establishes a logical connection between the sender and receiver before data transfer begins.

All packets belonging to the same communication session are treated as related.


Phases of Connection-Oriented Service

A connection-oriented service consists of three phases.

1. Connection Establishment

The sender and receiver first establish a logical connection.

Client

Connection Request

──────────────►

Server

Connection Accepted

Only after the connection is established can data be transmitted.


2. Data Transfer

Packets are transmitted.

They are

  • Numbered
  • Acknowledged
  • Delivered in order
Packet 0

↓

Packet 1

↓

Packet 2

Receiver obtains

Packet 0

Packet 1

Packet 2

Even if Packet 2 arrives before Packet 1,

the transport layer stores it temporarily until Packet 1 arrives.


3. Connection Termination

After communication,

the connection is closed.

Client

Close Request

────────────►

Server

ACK

Connection Closed

Working of Connection-Oriented Service

Client Process

↓

Connection Establishment

↓

Packet 0

↓

Packet 1

↓

Packet 2

↓

Connection Termination

↓

Server Process




Features

  • Logical connection established.
  • Reliable communication.
  • Sequence numbers used.
  • Acknowledgments used.
  • Lost packets retransmitted.
  • Duplicate packets discarded.
  • Out-of-order packets reordered.
  • Flow control supported.
  • Error control supported.
  • Congestion control supported.

Illustration

Client                            Server

Connection Request  ----------->

                 <----------- ACK

Packet 0 ---------------------->

Packet 1 ---------------------->

Packet 2 ---------------------->

                 <----------- ACKs

Close Request ----------------->

                 <----------- ACK

Why Connection-Oriented Service is Reliable

Suppose Packet 2 is lost.

Sender

Packet 0

Packet 1

Packet 2 (Lost)

Packet 3

Receiver receives

Packet 0

Packet 1

Packet 3

The receiver detects that Packet 2 is missing because of its sequence number.

It waits or requests retransmission.

After Packet 2 arrives,

the application receives

Packet 0

Packet 1

Packet 2

Packet 3

Thus,

correct ordering is maintained.


Finite State Machine (FSM)

The behavior of a transport protocol is often represented using a Finite State Machine (FSM), where the protocol moves through a series of states based on events.


FSM for Connectionless Service

A connectionless transport protocol has only one state.



  • No connection setup.
  • No connection termination.
  • Data can be sent at any time.

FSM for Connection-Oriented Service

A connection-oriented protocol passes through several states.

Closed
   │
   ▼
Open-Wait-I
   │
   ▼
Open-Wait-II
   │
   ▼
Established
   │
   ▼
Close-Wait-I
   │
   ▼
Close-Wait-II
   │
   ▼
Closed

Explanation of States

  • Closed – No connection exists.
  • Open-Wait-I – Connection request has been sent.
  • Open-Wait-II – Waiting for the remote side to complete the connection.
  • Established – Connection is active; data transfer occurs.
  • Close-Wait-I – Close request has been sent.
  • Close-Wait-II – Waiting for the remote side to close the connection.
  • Closed – Connection terminated.

This FSM illustrates the life cycle of a connection-oriented communication.




Connectionless vs Connection-Oriented Service

FeatureConnectionless Service    Connection-Oriented Service
Connection Establishment    Not RequiredRequired
Packet DependencyIndependentDependent
ReliabilityNo GuaranteeReliable
Packet OrderingMay Arrive Out of OrderDelivered in Order
Error ControlNot AvailableAvailable
Flow ControlNot AvailableAvailable
Congestion ControlNot AvailableAvailable
AcknowledgmentNot UsedUsed
RetransmissionNot AvailableAvailable
SpeedFasterSlightly Slower
OverheadLowHigher
ExampleUDPTCP

TCP and UDP

TCP (Connection-Oriented)

  • Reliable communication
  • Uses acknowledgments
  • Uses sequence numbers
  • Performs flow control
  • Performs congestion control
  • Performs error control

Applications:

  • HTTP/HTTPS
  • FTP
  • Email (SMTP, POP3, IMAP)
  • SSH

UDP (Connectionless)

  • No connection establishment
  • No acknowledgments
  • No retransmissions
  • Faster communication

Applications:

  • DNS
  • VoIP
  • Online gaming
  • Live video streaming
  • Video conferencing

Summary

  • The Transport Layer provides two types of services: connectionless and connection-oriented.
  • In a connectionless service, each packet is transmitted independently without establishing a connection. There is no guarantee of delivery, ordering, or reliability, making it suitable for applications where speed is more important than accuracy. UDP is the transport protocol that provides this service.
  • In a connection-oriented service, a logical connection is established before data transfer, followed by reliable data transmission and connection termination. It uses sequence numbers, acknowledgments, flow control, error control, and congestion control to ensure reliable and ordered delivery. TCP is the transport protocol that provides this service.
  • The behavior of these services can be represented using a Finite State Machine (FSM). A connectionless protocol remains in a single operational state, whereas a connection-oriented protocol progresses through multiple states for connection establishment, data transfer, and connection termination.

Comments

Popular posts from this blog

Computer Networks PCCST501 Semester 5 KTU CS 2024 Scheme - Dr Binu V P

Introduction to Computer Networks

Introduction to Local Area Network (LAN)