0% found this document useful (0 votes)
5 views10 pages

Unit 4transport Layer

The Transport Layer in the OSI and TCP/IP models facilitates end-to-end communication between processes, providing services like segmentation, flow control, and error control. It utilizes protocols such as TCP for reliable communication and UDP for faster, connectionless communication. Additionally, it implements congestion control mechanisms and traffic shaping algorithms like Leaky Bucket and Token Bucket to manage data transmission effectively.

Uploaded by

purabdon9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views10 pages

Unit 4transport Layer

The Transport Layer in the OSI and TCP/IP models facilitates end-to-end communication between processes, providing services like segmentation, flow control, and error control. It utilizes protocols such as TCP for reliable communication and UDP for faster, connectionless communication. Additionally, it implements congestion control mechanisms and traffic shaping algorithms like Leaky Bucket and Token Bucket to manage data transmission effectively.

Uploaded by

purabdon9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Unit 4

Transport Layer
 The Transport Layer is a crucial layer in the OSI Model and TCP/IP Model
that ensures end-to-end communication between processes. It provides
services like segmentation, flow control, error control, and port
addressing.
 Data from the application layer is divided into smaller units called
segments and transmitted reliably or unreliably depending on the
protocol used.
 Protocols such as TCP ensure reliable delivery with error checking and
retransmission, while UDP offers faster but connectionless
communication. Overall, the Transport Layer guarantees that data
reaches the correct application efficiently and accurately across a
network.

Services provided by Transport Layer:


1. End-to-end Connection between Hosts
The transport layer is also responsible for creating the end-to-end Connection
between hosts, for which it mainly uses TCP and UDP. TCP is a secure,
connection-oriented protocol that uses a handshake protocol to establish a
robust connection between two end hosts.
2. Multiplexing and Demultiplexing
Multiplexing(many to one) is when data is acquired from several processes from
the sender and merged into one packet along with headers and sent as a single
packet.

Multiplexing allows the simultaneous use of different processes over a network


that is running on a host. The processes are differentiated by their port
numbers. Similarly, Demultiplexing(one to many) is required at the receiver side
when the message is distributed into different processes.

[Link] Establishment

When two devices in a network wants to establish a connection using TCP, it is


done through 3-Way Handshake Process.

 The first computer connects to the second computer by sending a SYN packet
to a specified port number.
 If the second computer is listening, it will respond with a SYN/ACK.
 When the first computer receives the SYN/ACK, it replies with an ACK packet.
 After this, the two devices can communicate normally.

4. Flow Control
The transport layer provides a flow control mechanism between the adjacent
layers of the TCP/IP model. TCP also prevents data loss due to a fast sender and
slow receiver by imposing some flow control techniques.

5. Congestion Control

Congestion control is a mechanism used by the transport layer to regulate data transmission
and prevent network overload. It adjusts the sending rate based on network conditions.
Techniques like slow start, congestion avoidance, fast retransmit, and fast recovery help
maintain efficient communication and reduce packet loss and delay.
Transport Layer Protocols
Transmission Control Protocol(TCP)
 Transmission Control Protocol (TCP) is a reliable, connection-oriented
protocol used in the Transport Layer of computer networks. It ensures
accurate and ordered delivery of data between sender and receiver.
 TCP establishes a connection using the three-way handshake (SYN, SYN-
ACK, ACK) before data transfer begins. It provides error detection, flow
control, and congestion control to maintain network stability. Data is
divided into segments, each with sequence numbers for proper
reassembly.
 If any segment is lost, TCP retransmits it. This makes TCP suitable for
applications like web browsing, email, and file transfer where reliability is
essential.
 TCP Functions

1. Connection Establishment (Three-Way Handshake)


TCP is connection-orientated, meaning a connection must be established before any
data is sent. This is done using a three-way handshake:

 SYN (Synchronize): The sender sends a SYN segment to the receiver to


request a connection.
 SYN-ACK (Synchronize-Acknowledge): The receiver responds with a SYN-
ACK segment, acknowledging the request and agreeing to the connection.
 ACK (Acknowledge): The sender replies with an ACK, confirming the
connection is established.

2. Reliable Data Delivery


TCP guarantees data delivery by acknowledging received packets and retransmitting lost
or corrupted segments to maintain complete and accurate communication.
3. Segmentation and Reassembly
TCP divides large data into smaller segments for transmission and reassembles them
correctly at the destination using sequence numbers.
4. Error Detection and Recovery
TCP detects errors using checksums and recovers lost data by retransmitting segments
when acknowledgments are not received within a specific time.
5. Flow Control
TCP controls data flow between sender and receiver using sliding window mechanism,
preventing receiver overload by adjusting transmission speed dynamically.
6. Congestion Control
TCP manages network congestion using algorithms like slow start and congestion
avoidance, reducing transmission rate when network traffic becomes heavy.
7. Ordered Delivery
TCP ensures data arrives in correct order by assigning sequence numbers and
rearranging segments at the receiver before delivering to application layer.
8. Full-Duplex Communication
TCP supports simultaneous two-way communication, allowing both sender and receiver
to send and receive data at the same time independently.

TCP Header

1. Source Port (16 bits): Identifies the port number of the sending application.
It helps the receiver know which application sent the data.

2. Destination Port (16 bits): Specifies the receiving application’s port number,
ensuring data is delivered to the correct process on the destination device.
3. Sequence Number (32 bits): Indicates the byte number of the first data byte
in this segment. Used for ordering and reliable data delivery.

4. Acknowledgement Number (32 bits): Contains the next expected byte


number from the sender. Confirms successful receipt of previous data
segments.

5. Header Length / Data Offset (4 bits): Specifies the size of the TCP header in
32-bit words. Helps determine where actual data begins.

6. Reserved (6 bits): Reserved for future use. Currently set to zero but kept for
possible protocol enhancements.

7. Control Flags (6 bits): Used to control connection and data flow:

 URG – Urgent data present


 ACK – Acknowledgement field is valid
 PSH – Push data immediately to application
 RST – Reset the connection
 SYN – Synchronize sequence numbers (connection start)
 FIN – Finish connection (termination)

8. Window Size (16 bits): Defines how much data (in bytes) the receiver is
willing to accept. Used for flow control.

9. Checksum (16 bits) : Used for error detection. Ensures integrity of header
and data during transmission.

10. Urgent Pointer (16 bits): Points to the end of urgent data when URG flag is
set. Indicates priority data that must be processed first.

11. Options (0–40 bytes) : Optional field used for advanced features like
maximum segment size (MSS), window scaling, and timestamps.
UDP
User Datagram Protocol
 User Datagram Protocol (UDP) is a connectionless transport layer protocol
that provides fast and efficient data transmission. It does not establish a
connection before sending data, making it faster but less reliable than
TCP.
 UDP sends data in the form of datagrams without guaranteeing delivery,
order, or duplication protection. It has minimal overhead due to a small
header size.
 UDP is suitable for real-time applications like video streaming, online
gaming, and VoIP, where speed is more critical than reliability. It uses port
numbers for process-to-process communication and supports multicast
and broadcast transmission.

Services provided by UDP (User Datagram Protocol):

1. Process-to-Process Communication
Uses port numbers to deliver data to the correct application (e.g., DNS, streaming apps).
2. Connectionless Service
No connection setup (no handshake), so data is sent immediately, reducing delay.
3. Fast Data Transmission
Minimal overhead (small header), making it faster than TCP.
4. Unreliable Delivery
No guarantee of delivery, order, or duplication control.
5. Supports Broadcast and Multicast
Can send data to multiple receivers at once (useful in streaming and networking).
UDP Header

Field Size Description

Source Port 16 bits Identifies the sender’s port number.

Destination Port 16 bits Identifies the receiver’s port number.

Length 16 bits Specifies the total length of UDP header and data.

Checksum 16 bits Used for error detection (optional in IPv4, mandatory in IPv6).
Traffic Shaping Algorithm(Congestion Control)
Traffic shaping is a mechanism to control the amount and the rate of traffic sent
to the network. It is an approach of congestion management called traffic
shaping. Traffic shaping helps to regulate the rate of data transmission and
reduces congestion.

There are two types of traffic shaping algorithms:


(i) Leaky Bucket Algorithm
(ii) Token Bucket Algorithm

(i) Leaky Bucket Algorithm


The Leaky Bucket Algorithm is a method used in networking to regulate the rate
at which data is transmitted. It maintains a steady sending speed, even when
data arrives in sudden bursts, preventing the network from becoming
overloaded.
 Incoming packets are stored in a fixed-size buffer before transmission.
 Data is released into the network at a constant rate.
 Packets arriving after the buffer is full are discarded.
 Helps routers and switches use bandwidth in a controlled manner.

Suppose we have a bucket in which we are pouring water in a random order,


but we have to get water at a fixed rate. For this, we make a hole at the bottom
of the bucket. It ensures that water comes out at a fixed rate. Also, if the bucket
is full, we stop pouring water into it.

The input rate can vary, but the output rate remains constant. Similarly, in
networking, a technique called the leaky bucket can smooth out bursty traffic.
Bursty chunks are stored in the bucket and sent out at an average rate.

 This algorithm is used to control the rate in a network.


 It is implemented as a single server queue with constant service time.
If the bucket (buffer) overflows, then packets are discarded.

 In this algorithm, the input rate can vary, but the output rate remains
constant.
 This algorithm converts bursty traffic into fixed-rate traffic by averaging
the data rate.

(ii) Token Bucket Algorithm

The leaky bucket algorithm enforces a rigid pattern at the output stream
irrespective of the input pattern. For many applications, it is better to allow
output to speed up somewhat when a large burst arrives, rather than lose its
data.

The token bucket algorithm provides such a solution. In this algorithm, the
bucket holds tokens generated at regular intervals.

Steps of this algorithm are as follows:


(i) At regular intervals, tokens are added to the bucket.
(ii) The bucket has a maximum capacity.
(iii) If there is a ready packet, a token is removed from the bucket and the
packet is sent.
(iv) If there is no token in the bucket, the packet cannot be sent.
In the diagram/figure, two scenarios are shown before and after the tokens are
consumed.

 In figure A, a bucket holds two tokens and three packets are waiting to be
sent out of the interface.
 In figure B, two packets have been sent by consuming two tokens, and
one packet is still left.

The token bucket algorithm is less restrictive than the leaky bucket algorithm,
as it allows bursty traffic. However, the limit of the burst is restricted by the
number of tokens available in the bucket at a particular instant of time.

The implementation of the classic token bucket algorithm is simple. A variable


(counter) is used to count the tokens.

 This counter is incremented every second.


 It is decremented whenever a packet is sent.
 Whenever the counter reaches 0, no further packet is sent out.

Diagram Explanation

 (a) Token bucket holding two tokens → before packets are sent.
 (b) After sending two packets → no token is left, so no packet can be sent
until tokens are refilled.

You might also like