Computer Networks
User Datagram Protocol
Prepared by,
P.Nivetha,
Asst.Prof,
Dept. of BCA,
Bon Secours College for Women,
Thanjavur
UDP
• It is a connectionless, unreliable transport
protocol.
• It performs very limited error checking.
• UDP is a very simple protocol using a minimum of
overhead.
• If a process wants to send a small message it can
use UDP and does not care much about
reliability.
• UDP takes much less interaction between the
sender and receiver than using TCP or SCTP.
1. User Datagram
• UDP packets, called user datagram's, have a
fixed-size header of 8 bytes.
The fields are as follows:
1. Source port number.
2. Destination port number.
3. Length.
4. Checksum.
i)Source port number
• It used by the process running on the source
host.
• It is 16 bits long, which means that the port
number can range from 0 to 65,535.
• If source host is the client(sending a Req)- is
called as ephemeral port number requested
by the process.
• If the source host is the server(Sending a
Resp)- known as well-known port number.
ii) Destination port number
• It used by the process running on the
destination host.
• It is also 16 bits long.
• If the destination host is the server(sending a
request)- known as well-known port number.
• If the destination host is the client(sending a
response)- called as ephemeral port number.
iii) Length
• 16-bit field that defines the total length of the
user datagram, header & data.
• Has a total length of 0 to 65,535 bytes.
• A user datagram is encapsulated in an IP
datagram.
• There is a field in the IP datagram that defines the
total length.
• There is another field in the IP datagram that
defines the length of the header.
UDP length = IP length - IP header's length
iv) Checksum
• It used to detect errors over the entire user datagram ,header &data.
• The checksum is used in the Internet by several protocols.
Example 10.18
 Suppose our data is a list of five 4-bit numbers that we want to send
to a destination.
 In addition to sending these numbers, we send the sum of the
numbers.
 For example, if the set of numbers is (7, 11, 12, 0, 6), we send (7, 11,
12,0,6,36), where 36 is the sum of the original numbers.
 The receiver adds the five numbers and compares the result with the
sum.
 If the two are the same, the receiver assumes no error, accepts the
five numbers, and discards the sum.
 Otherwise, there is an error somewhere and the data are not
accepted.
Continued…
Example 10.19
 We can make the job of the receiver easier if
we send the negative (complement) of the
sum, called the checksum.
In this case, we send (7, 11, 12,0,6, -36).
 The receiver can add all the numbers received
(including the checksum).
 If the result is 0, it assumes no error;
otherwise, there is an error.
2. UDP Operation
• UDP uses concepts common to the transport
layer.
1. Connectionless Services.
2. Flow and Error Control.
3. Encapsulation and Decapsulation.
4. Queuing
Use of UDP
• UDP is suitable for a process that requires simple
request-response communication.
• UDP is suitable for a process with internal flow
and error control mechanisms.
• UDP is a suitable transport protocol for
multicasting.
• UDP is used for management processes such as
SNMP.
• UDP is used for some route updating protocols
such as Routing Information Protocol (RIP).
Thank You

Unit 4 UDP

  • 1.
    Computer Networks User DatagramProtocol Prepared by, P.Nivetha, Asst.Prof, Dept. of BCA, Bon Secours College for Women, Thanjavur
  • 2.
    UDP • It isa connectionless, unreliable transport protocol. • It performs very limited error checking. • UDP is a very simple protocol using a minimum of overhead. • If a process wants to send a small message it can use UDP and does not care much about reliability. • UDP takes much less interaction between the sender and receiver than using TCP or SCTP.
  • 3.
    1. User Datagram •UDP packets, called user datagram's, have a fixed-size header of 8 bytes. The fields are as follows: 1. Source port number. 2. Destination port number. 3. Length. 4. Checksum.
  • 4.
    i)Source port number •It used by the process running on the source host. • It is 16 bits long, which means that the port number can range from 0 to 65,535. • If source host is the client(sending a Req)- is called as ephemeral port number requested by the process. • If the source host is the server(Sending a Resp)- known as well-known port number.
  • 5.
    ii) Destination portnumber • It used by the process running on the destination host. • It is also 16 bits long. • If the destination host is the server(sending a request)- known as well-known port number. • If the destination host is the client(sending a response)- called as ephemeral port number.
  • 6.
    iii) Length • 16-bitfield that defines the total length of the user datagram, header & data. • Has a total length of 0 to 65,535 bytes. • A user datagram is encapsulated in an IP datagram. • There is a field in the IP datagram that defines the total length. • There is another field in the IP datagram that defines the length of the header. UDP length = IP length - IP header's length
  • 7.
    iv) Checksum • Itused to detect errors over the entire user datagram ,header &data. • The checksum is used in the Internet by several protocols. Example 10.18  Suppose our data is a list of five 4-bit numbers that we want to send to a destination.  In addition to sending these numbers, we send the sum of the numbers.  For example, if the set of numbers is (7, 11, 12, 0, 6), we send (7, 11, 12,0,6,36), where 36 is the sum of the original numbers.  The receiver adds the five numbers and compares the result with the sum.  If the two are the same, the receiver assumes no error, accepts the five numbers, and discards the sum.  Otherwise, there is an error somewhere and the data are not accepted.
  • 8.
    Continued… Example 10.19  Wecan make the job of the receiver easier if we send the negative (complement) of the sum, called the checksum. In this case, we send (7, 11, 12,0,6, -36).  The receiver can add all the numbers received (including the checksum).  If the result is 0, it assumes no error; otherwise, there is an error.
  • 9.
    2. UDP Operation •UDP uses concepts common to the transport layer. 1. Connectionless Services. 2. Flow and Error Control. 3. Encapsulation and Decapsulation. 4. Queuing
  • 10.
    Use of UDP •UDP is suitable for a process that requires simple request-response communication. • UDP is suitable for a process with internal flow and error control mechanisms. • UDP is a suitable transport protocol for multicasting. • UDP is used for management processes such as SNMP. • UDP is used for some route updating protocols such as Routing Information Protocol (RIP).
  • 11.