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

User Datagram Protocol (Udp)

The User Datagram Protocol (UDP) is a simple transport layer protocol that provides best effort delivery of datagrams over IP networks. UDP does not provide reliability, flow control, or error checking. It is faster than TCP but packets may arrive out of order or not at all. UDP is commonly used for real-time applications like video streaming where packet loss is acceptable.

Uploaded by

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

User Datagram Protocol (Udp)

The User Datagram Protocol (UDP) is a simple transport layer protocol that provides best effort delivery of datagrams over IP networks. UDP does not provide reliability, flow control, or error checking. It is faster than TCP but packets may arrive out of order or not at all. UDP is commonly used for real-time applications like video streaming where packet loss is acceptable.

Uploaded by

Harsh Isamalia
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

USER DATAGRAM PROTOCOL (UDP)

• The User Datagram Protocol (UDP) is simplest Transport Layer communication


protocol available of the TCP/IP protocol suite.

• It involves minimum amount of communication mechanism. UDP is said to be an


unreliable transport protocol but it uses IP services which provides best effort
delivery mechanism.

• In UDP, the receiver does not generate an acknowledgement of packet received


and in turn, the sender does not wait for any acknowledgement of packet sent.
This shortcoming makes this protocol unreliable as well as easier on processing.
Requirement of UDP
• A question may arise, why do we need an unreliable protocol to transport the
data? We deploy UDP where the acknowledgement packets share significant
amount of bandwidth along with the actual data.

• For example, in case of video streaming, thousands of packets are forwarded


towards its users. Acknowledging all the packets is troublesome and may
contain huge amount of bandwidth wastage.

• The best delivery mechanism of underlying IP protocol ensures best efforts to


deliver its packets, but even if some packets in video streaming get lost, the
impact is not calamitous and can be ignored easily. Loss of few packets in video
and voice traffic sometimes goes unnoticed.
Features
• UDP is used when acknowledgement of data does not hold
any significance.
• UDP is good protocol for data flowing in one direction.
• UDP is simple and suitable for query based
communications.
• UDP is not connection oriented.
• UDP does not provide congestion control mechanism.
• UDP does not guarantee ordered delivery of data.
• UDP is stateless.
• UDP is suitable protocol for streaming applications such as
VoIP, multimedia streaming.
• Normally used for real time applications which can not
tolerate uneven delays between sections of a received
message.
• Following implementations uses UDP as a transport layer protocol:
 NTP (Network Time Protocol)
 DNS (Domain Name Service)
 BOOTP, DHCP.
 NNP (Network News Protocol)
 Quote of the day protocol
 TFTP, RTSP, RIP.
• Application layer can do some of the tasks through UDP-
 Trace Route
 Record Route
 Time stamp
UDP Header/DATAGRAM
• UDP header is as simple as its function.

• UDP header contains four main parameters:


• Source Port  - This 16 bits information is used to identify the source port of the
packet.
• Destination Port  - This 16 bits information, is used identify application level
service on destination machine.
• Length  - Length field specifies the entire length of UDP packet (including
header). It is 16-bits field and minimum value is 8-byte, i.e. the size of UDP
header itself.
• Checksum  - This field stores the checksum value generated by the sender
before sending. IPv4 has this field as optional so when checksum field does not
contain any value it is made 0 and all its bits are set to zero.
ENCAPSULATION AND DECAPSULATION

• In a networking model, the term encapsulation refers to a process in which protocol


information is added to the data.
• The term de-encapsulation refers to a process in which information added through the
encapsulation process is removed.
• Protocol information can be added before and after the data. If the information is added
before the data, it is known as a header. If the information is added after the data, it is
known as a trailer.
The transmission Control Protocol (TCP) 
The transmission Control Protocol (TCP) 
• Features/Services
• TCP is reliable protocol. That is, the receiver always sends either
positive or negative acknowledgement about the data packet to the
sender, so that the sender always has bright clue about whether the
data packet is reached the destination or it needs to resend it.
• TCP ensures that the data reaches intended destination in the same
order it was sent.
• TCP is connection oriented. TCP requires that connection between
two remote points be established before sending actual data.
• TCP provides error-checking and recovery mechanism.
• TCP provides end-to-end communication.
• TCP provides flow control ,congestion control and quality of service.
• TCP operates in Client/Server point-to-point mode.
• TCP provides full duplex server, i.e. it can perform roles of both
receiver and sender.
• Header
• The length of TCP header is minimum 20 bytes long
and maximum 60 bytes.
• Source Port (16-bits)  - It identifies source port of the application
process on the sending device.
• Destination Port (16-bits) - It identifies destination port of the
application process on the receiving device.
• Sequence Number (32-bits) - Sequence number of data bytes of
a segment in a session.
• Acknowledgement Number (32-bits)  - When ACK flag is set, this
number contains the next sequence number of the data byte
expected and works as acknowledgement of the previous data
received.
• Data Offset (4-bits)  - This field implies both, the size of TCP
header (32-bit words) and the offset of data in current packet in
the whole TCP segment.
• Reserved (3-bits)  - Reserved for future use and all are set zero
by default.
• Flags (1-bit each):
• URG,ACK,SYN,FIN,PSH ETC
• Windows Size  - This field is used for flow control between two stations
and indicates the amount of buffer (in bytes) the receiver has allocated
for a segment, i.e. how much data is the receiver expecting.
• Checksum - This field contains the checksum of Header, Data and Pseudo
Headers.
• Urgent Pointer  - It points to the urgent data byte if URG flag is set to 1.
• Options  - It facilitates additional options which are not covered by the
regular header. Option field is always described in 32-bit words. If this
field contains data less than 32-bit, padding is used to cover the
remaining bits to reach 32-bit boundary.
Differences between TCP and UDP
Transmission control protocol (TCP) User datagram protocol (UDP)

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

TCP is reliable as it guarantees the delivery of data to the The delivery of data to the destination cannot be guaranteed
destination router. in UDP.

TCP provides extensive error checking mechanisms. It is UDP has only the basic error checking mechanism using
because it provides flow control and acknowledgement of
data. checksums.

Sequencing of data is a feature of Transmission Control


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

TCP is comparatively slower than UDP. UDP is faster, simpler, and more efficient than TCP.

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

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

TCP is heavy-weight. UDP is lightweight.

TCP doesn’t support Broadcasting. UDP supports Broadcasting.

TCP is used by HTTP, HTTPs, FTP, SMTP and Telnet. UDP is used by DNS, DHCP, TFTP, SNMP, RIP, and VoIP.
Connection-Oriented vs Connectionless Service

S. Comparison Connection-oriented Service Connection Less Service


No Parameter
1. Related System It is designed and developed based on the telephone system. It is service based on the postal system.

2. Definition It is used to create an end to end connection between the senders to the It is used to transfer the data packets between
receiver before transmitting the data over the same or different network. senders to the receiver without creating any
connection.

3. Virtual path It creates a virtual path between the sender and the receiver. It does not create any virtual connection or path
between the sender and the receiver.
4. Authentication It requires authentication before transmitting the data packets to the It does not require authentication before
receiver. transferring data packets.
5. Data Packets Path All data packets are received in the same order as those sent by the Not all data packets are received in the same order
sender. as those sent by the sender.
6. Bandwidth It requires a higher bandwidth to transfer the data packets. It requires low bandwidth to transfer the data
Requirement packets.
7. Data Reliability It is a more reliable connection service because it guarantees data packets It is not a reliable connection service because it
transfer from one end to the other end with a connection. does not guarantee the transfer of data packets
from one end to another for establishing a
connection.
8. Congestion There is no congestion as it provides an end-to-end connection between There may be congestion due to not providing an
sender and receiver during transmission of data. end-to-end connection between the source and
receiver to transmit of data packets.
9. Examples Transmission Control Protocol (TCP) is an example of a connection- User Datagram Protocol (UDP), Internet Protocol
oriented service. (IP), and Internet Control Message Protocol
(ICMP) are examples of connectionless service.
TCP/UDP:SOCKET
WHAT IS SOCKET?
WHAT IS SOCKET?
WHAT IS SOCKET?
SOCKET

You might also like