0% found this document useful (0 votes)
2 views22 pages

Chapter 8. Transport Layer Notes

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 22

UNIT – IV

Chapter - 8
Introduction to Transport Layer
User Datagram Protocol
Packet Format
Features of UDP
Applications of UDP
Advantages & Disadvantages of UDP
Transmission Control Protocol
TCP Segment & TCP Connection
How TCP works?
Features of TCP Lecture slides by
Advantages & Disadvantages of UDP Sri. Srinivasa Babu .B
Review Questions Vijaya College, R V Road
Introduction to Transport Layer

Transport layer offers peer-to-peer and end-to-end connection between


two processes on remote hosts.
Transport layer takes data from upper layer (i.e. Application layer) and
then breaks it into smaller size segments, numbers each byte, and
hands over to lower layer (Network Layer) for delivery.
Introduction to Transport Layer

Transport Layer Protocols


The two main Transport layer protocols are:
 Transmission Control Protocol − It provides reliable communication
between two hosts.
 User Datagram Protocol − It provides unreliable communication
between two hosts.
Functions of Transport Layer
 The Transport Layer is responsible for end-to-end
communication of data packets.
 It provides a number of important functions that are
responsible for reliable, efficient, and organized data
transfer between host systems in a networked
environment.

Characteristics of Transport Layer


1. Service-point addressing
2. Segmentation and reassembly
3. Connection control
4. Flow control
5. Error control
User Datagram Protocol (UDP)
 UDP is not reliable protocol
 The protocol UDP is connectionless.
 When speed and size are more important than security
and dependability, this kind of protocol is employed.
 The data from the higher layer is supplemented with
transport-level addresses, checksum error control, and
length information by UDP, an end-to-end transport level
protocol.
 A user datagram is the packet that the UDP protocol
generates.
UDP Packet Format

UDP header is an 8-byte fixed and simple header, while for TCP it may
vary from 20 bytes to 60 bytes.
The first 8 Bytes contain all necessary header information and the
remaining part consists of data.
UDP port number fields are each 16 bits long, therefore the range for
port numbers is defined from 0 to 65535; port number 0 is reserved.
Port numbers help to distinguish different user requests or processes.
UDP Packet Format
 Source Port: Source Port is a 2 Byte long field used to
identify the port number of the source.
 Destination Port: It is a 2 Byte long field, used to
identify the port of the destined packet.
 Length: Length is the length of UDP including the
header and the data. It is a 16-bits field.
 Checksum: Checksum is 2 Bytes long field. It is the 16-
bit one’s complement of the one’s complement sum of
the UDP header, it is not mandatory in UDP.
Applications of UDP
 Used for simple request-response communication when the size of
data is less and hence there is lesser concern about flow and error
control.
 It is a suitable protocol for multicasting as UDP supports packet
switching.
 UDP is used for some routing update protocols like RIP(Routing
Information Protocol).
 Normally used for real-time applications which can not tolerate
uneven delays between sections of a received message.
 VoIP (Voice over Internet Protocol) services, such as Skype and
WhatsApp, use UDP for real-time voice communication.
 DNS (Domain Name System) also uses UDP for its query/response
messages.
 DHCP (Dynamic Host Configuration Protocol) uses UDP to
dynamically assign IP addresses to devices on a network.
Advantages of UDP
 Speed: UDP is faster than TCP because it does not have the
overhead of establishing a connection and ensuring reliable data
delivery.
 Lower latency: Since there is no connection establishment, there is
lower latency and faster response time.
 Simplicity: UDP has a simpler protocol design than TCP, making it
easier to implement and manage.
 Broadcast support: UDP supports broadcasting to multiple
recipients, making it useful for applications such as video streaming
and online gaming.
 Smaller packet size: UDP uses smaller packet sizes than TCP,
which can reduce network congestion and improve overall network
performance.
 User Datagram Protocol (UDP) is more efficient in terms of both
latency and bandwidth.
Disadvantages of UDP
 No reliability: UDP does not guarantee delivery of packets or order
of delivery, which can lead to missing or duplicate data.
 No congestion control: UDP does not have congestion control,
which means that it can send packets at a rate that can cause
network congestion.
 Vulnerable to attacks: UDP is vulnerable to denial-of-service
attacks , where an attacker can flood a network with UDP packets,
overwhelming the network and causing it to crash.
 Limited use cases: UDP is not suitable for applications that require
reliable data delivery, such as email or file transfers, and is better
suited for applications that can tolerate some data loss, such as
video streaming or online gaming.
Transmission Control Protocol(TCP)
 TCP is connection-oriented Protocol.
 TCP is reliable protocol.
 As TCP is connection-oriented protocol, so first the
connection is established between two ends and then
data is transferred and then the connection is terminated
after all data being sent.
TCP Segment
TCP Segment consists of
 Source port: It defines the port of the application, which is sending the
data. So, this field contains the source port address, which is 16 bits.
 Destination port: It defines the port of the application on the receiving side.
So, this field contains the destination port address, which is 16 bits.
 Sequence number: This field contains the sequence number of data bytes
in a particular session.
 Acknowledgment number: When the ACK flag is set, then this contains
the next sequence number of the data byte and works as an
acknowledgment for the previous data received.
For example, if the receiver receives the segment number 'x', then it
responds 'x+1' as an acknowledgment number.
 HLEN: It specifies the length of the header indicated by the 4-byte words in
the header. The size of the header lies between 20 and 60 bytes. Therefore,
the value of this field would lie between 5 and 15.
 Reserved: It is a 4-bit field reserved for future use, and by default, all are
set to zero.
 Flags
There are six control bits or flags:
 URG: It represents an urgent pointer. If it is set, then the data is processed
urgently.
 ACK: If the ACK is set to 0, then it means that the data packet does not contain
an acknowledgment.
 PSH: If this field is set, then it requests the receiving device to push the data to
the receiving application without buffering it.
 RST: If it is set, then it requests to restart a connection.
 SYN: It is used to establish a connection between the hosts.
 FIN: It is used to release a connection, and no further data exchange will happen.
 Window size
It is a 16-bit field. It contains the size of data that the receiver can
accept. This field is used for the flow control between the sender
and receiver and also determines the amount of buffer allocated by
the receiver for a segment.
 Checksum
It is a 16-bit field. This field is optional in UDP, but in the case of
TCP/IP, this field is mandatory.
 Urgent pointer
It is a pointer that points to the urgent data byte if the URG flag is set
to 1. It defines a value that will be added to the sequence number to
get the sequence number of the last urgent byte.
 Options
It provides additional options. The optional field is represented in 32-
bits. If this field contains the data less than 32-bit, then padding is
required to obtain the remaining bits.
Working of TCP
In TCP, the connection is established by using three-way
handshaking.
The client sends the segment with its sequence number.
The server, in return, sends its segment with its own
sequence number as well as the acknowledgement
sequence, which is one more than the client sequence
number.
When the client receives the acknowledgment of its
segment, then it sends the acknowledgment to the server.
In this way, the connection is established between the
client and the server.
Features of TCP protocol
The following are the features of a TCP protocol:

 Reliable
 Order of the data is maintained
 Connection-oriented
 Full duplex
 Stream-oriented
Advantages of TCP
 It provides a connection-oriented reliable service, which means that
it guarantees the delivery of data packets. If the data packet is lost
across the network, then the TCP will resend the lost packets.
 It provides a flow control mechanism using a sliding window
protocol.
 It provides error detection by using checksum and error control by
using Go Back or ARP protocol.
 It eliminates the congestion by using a network congestion
avoidance algorithm that includes various schemes such as additive
increase/multiplicative decrease (AIMD), slow start, and congestion
window.

Disadvantage of TCP
 It increases a large amount of overhead as each segment gets its
own TCP header, so fragmentation by the router increases the
overhead.
Difference Between TCP and UDP
TCP UDP

TCP is a connection-oriented protocol UDP is the connection-less protocol

TCP is reliable. UDP is not reliable.

TCP supports error-checking UDP has only the basic error-checking


mechanisms. mechanism using checksums.

An acknowledgment segment is
No acknowledgment segment.
present.

UDP is faster, simpler, and more


TCP is slower than UDP
efficient than TCP.

There is no retransmission of lost


Retransmission of lost packets is
packets in the User Datagram Protocol
possible in TCP, but not in UDP.
(UDP)

TCP has a (20-60) bytes variable length


The header length is fixed of 8 bytes.
header.

You might also like