0% found this document useful (0 votes)
3 views

UDP and TCP

The document provides an overview of the User Datagram Protocol (UDP), detailing its 8-byte header structure, key fields, and applications, such as VoIP and DNS. It contrasts UDP with Transmission Control Protocol (TCP), highlighting differences in reliability, speed, and error-checking mechanisms. Additionally, it outlines the advantages and disadvantages of using UDP, emphasizing its speed and simplicity, while noting its lack of reliability and vulnerability to attacks.

Uploaded by

prakash222326
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

UDP and TCP

The document provides an overview of the User Datagram Protocol (UDP), detailing its 8-byte header structure, key fields, and applications, such as VoIP and DNS. It contrasts UDP with Transmission Control Protocol (TCP), highlighting differences in reliability, speed, and error-checking mechanisms. Additionally, it outlines the advantages and disadvantages of using UDP, emphasizing its speed and simplicity, while noting its lack of reliability and vulnerability to attacks.

Uploaded by

prakash222326
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

UDP Header

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 Header

• 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, the pseudo-header of information
from the IP header, and the data, padded with zero octets at the end (if
necessary) to make a multiple of two octets.

Notes – Unlike TCP, the Checksum calculation is not mandatory in UDP. No Error control
or flow control is provided by UDP. Hence UDP depends on IP and ICMP for error
reporting. Also UDP provides port numbers so that is can differentiate between users
requests.

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. The delay in voice communication can
be noticeable if packets are delayed due to congestion control, so UDP is used to
ensure fast and efficient data transmission.
• DNS (Domain Name System) also uses UDP for its query/response messages.
DNS queries are typically small and require a quick response time, making UDP
a suitable protocol for this application.
• DHCP (Dynamic Host Configuration Protocol) uses UDP to dynamically assign
IP addresses to devices on a network. DHCP messages are typically small, and
the delay caused by packet loss or retransmission is generally not critical for this
application.
• Following implementations uses UDP as a transport layer protocol:
o NTP (Network Time Protocol)
o DNS (Domain Name Service)
o BOOTP, DHCP.
o NNP (Network News Protocol)
o Quote of the day protocol
o TFTP, RTSP, RIP.
• The application layer can do some of the tasks through UDP-
o Trace Route
o Record Route
o Timestamp
• UDP takes a datagram from Network Layer , attaches its header, and sends it to
the user. So, it works fast.

TCP vs UDP
User Datagram Protocol
Basis Transmission Control Protocol (TCP) (UDP)

UDP is the Datagram-


oriented protocol. This is
TCP is a connection-oriented protocol. because there is no
Connection orientation means that the overhead for opening a
communicating devices should establish connection, maintaining a
a connection before transmitting data connection, or terminating
and should close the connection after a connection. UDP is
transmitting the data. efficient for broadcast and
multicast types of network
Type of Service transmission.

TCP is reliable as it guarantees the The delivery of data to the


delivery of data to the destination destination cannot be
Reliability router. guaranteed in UDP.

TCP provides extensive error-checking


UDP has only the basic
mechanisms. It is because it provides
error-checking mechanism
Error checking flow control and acknowledgment of
using checksums.
mechanism data.

Acknowledgme An acknowledgment segment is No acknowledgment


nt present. segment.
User Datagram Protocol
Basis Transmission Control Protocol (TCP) (UDP)

There is no sequencing of
Sequencing of data is a feature of
data in UDP. If the order is
Transmission Control Protocol (TCP).
required, it has to be
this means that packets arrive in order
managed by the
at the receiver.
Sequence application layer.

UDP is faster, simpler, and


TCP is comparatively slower than UDP.
Speed more efficient than TCP.

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

TCP has a (20-60) bytes variable length UDP has an 8 bytes fixed-
Header Length header. length header.

Weight TCP is heavy-weight. UDP is lightweight.

Handshaking Uses handshakes such as SYN, ACK, It’s a connectionless


Techniques SYN-ACK protocol i.e. No handshake

UDP supports
TCP doesn’t support Broadcasting.
Broadcasting Broadcasting.

UDP is used
TCP is used by HTTP, by DNS, DHCP,
HTTPs , FTP , SMTP and Telnet . TFTP, SNMP , RIP,
Protocols and VoIP.

UDP connection is a
The TCP connection is a byte stream.
Stream Type message stream.

Overhead Low but higher than UDP. Very low.

This protocol is used in


This protocol is primarily utilized in
situations where quick
situations when a safe and trustworthy
communication is
communication procedure is necessary,
necessary but where
such as in email, on the web surfing,
dependability is not a
and in military services.
Applications concern, such as VoIP,
User Datagram Protocol
Basis Transmission Control Protocol (TCP) (UDP)

game streaming, video,


and music streaming, etc.

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.

You might also like