Department of Electrical Engineering, UET Lahore
EE432 Computer Networks Lab
Course Instructor: Dr Naveed Nawaz Dated:16/09/2024
Session: Spring 2023 Semester: 8th
LAB 4 Transport Layer Protocol: User Datagram Protocol (UDP)
Report Marks
Name Roll. No. Viva Marks (5) Total Marks (15)
(10)
Signature: ____________________________
Contents
LAB 4 TRANSPORT LAYER PROTOCOL: USER DATAGRAM PROTOCOL (UDP) 1
4.1. Objectives 3
4.2. Instructions 3
4.3. Background 3
4.3.1. Introduction to UDP 3
4.3.2. UDP Datagrams 3
4.4. Procedure 4
4.5. Questions 4
Transport Layer Protocol: User Datagram Protocol (UDP)
4.1. Objectives
In performing this lab, students will achieve the following goals:
● Analyze the behavior of UDP in detail
● Determine the number of fields in UDP header, the value in the UDP header fields, and maximum number of bytes in
UDP payload, source & destination port numbers
4.2. Instructions
1. Read carefully before starting the lab.
2. These exercises are to be done individually.
3. You are supposed to provide the answers to the questions listed at the end of this manual by hand or in text and submit
the hardcopy to lab instructor at the end of lab. In the case that you are required to submit images/screenshots, you will
be required to submit the files on Google classroom.
4. Avoid plagiarism by copying from the Internet or from your peers. You may refer to source/ text but you must
paraphrase the original work. Your submitted work should be written by yourself.
5. Complete the lab half an hour before the lab ends.
6. At the end of the lab, a viva will be conducted to evaluate your understanding.
4.3. Background
4.3.1. Introduction to UDP
UDP (User Datagram Protocol) is a simple transport layer protocol for client/server network applications based on Internet
Protocol (IP). UDP is the main alternative to TCP and one of the oldest network protocols in existence, introduced in 1980.
UDP is often used in videoconferencing applications or computer games specially tuned for real-time performance. To
achieve higher performance, the protocol allows individual packets to be dropped (with no retries) and UDP packets to be
received in a different order than they were sent as dictated by the application.
4.3.2. UDP Datagrams
UDP network traffic is organized in the form of datagrams. A datagram comprises one message unit. The first eight (8)
bytes of a datagram contain header information and the remaining bytes contain message data.
A UDP datagram header consists of four (4) fields of two bytes each: Source port number, Destination port number,
Datagram size and checksum.
4.3.2.1. UDP port number
UDP port numbers allow different applications to maintain their own channels for data similar to TCP. UDP port headers
are two bytes long; therefore, valid UDP port numbers range from 0 to 65535.
4.3.2.2. Datagram size
The UDP datagram size is a count of the total number of bytes contained in header and data sections. As the header length
is a fixed size, this field effectively tracks the length of the variable-sized data portion (sometimes called payload). The size
of datagrams varies depending on the operating environment but has a maximum of 65535 bytes.
4.3.2.3. Checksum
UDP checksums protect message data from tampering. The checksum value represents an encoding of the datagram data
calculated first by the sender and later by the receiver. Should an individual datagram be tampered with or get corrupted
during transmission, the UDP protocol detects a checksum calculation mismatch. In UDP, checksumming is optional as
opposed to TCP where checksums are mandatory.
4.4. Procedure
Do the following:
1. Start up the Wireshark software.
2. Begin packet capture, select the Capture pull down menu and select Options.
3. Selecting the network interface on which packets would be captured: You can use most of the default values in this
window. The network interfaces (i.e., the physical connections) that your computer has to the network will be shown
in the Interface pull down menu at the top of the Capture Options window. Click Start. Packet capture will now begin.
4. Start up your favorite web browser, and type any site which uses the UDP packets for traffic flow in the packet listing
window.
5. Stopping the capture and inspecting captured packets: After your browser has displayed the page, stop Wireshark
packet capture
6. Filtering: Filter the UDP packets.
7. Details of a packet: Select the UDP messages shown in the packet-listing window and analyze by looking into the
detail of packets pane and answer the questions given at the end of this document.
8. Obtaining credit for this lab: Now, please proceed to the questions section to answer the questions. You must note
down your answers in this file itself. Please note that every group must upload this file (after duly filling in the
answers) through the appropriate link at your LMS course site for the specific date of your lab to obtain credit. Please
clarify with your instructor/ lab engineer if you have any queries.
4.5. Questions
1. Select one packet and determine the source MAC address of that UDP packet.
2. Select one packet and determine the destination MAC address of that UDP packet.
3. Select one packet and determine how many fields are there in the UDP header.
4. List the name of these fields.
5. From the packet content field, determine the length (in bytes) of each of the UDP header fields.
6. What is the source and the destination port number of UDP packet.
7. Analyze the udp packet and answer that the value in the Length field is the length of what? Verify your claim with
your captured UDP packet.
8. What is the maximum number of bytes that can be included in a UDP payload.
9. What is the largest possible source port number?
10. What is the protocol number for UDP? Give your answer in both hexadecimal and decimal notation. (To answer this
question, you’ll need to look into the IP header.)
11. Examine a pair of UDP packets in which the first packet is sent by your host and the second packet is a reply to the
first packet. Describe the relationship between the port numbers in the two packets.
12. Show the data attached to the UDP packet in both hexadecimal and decimal notation.
Assessment Rubrics for
Computer Networks Lab 4
Student Name: ______________________________ Roll Number: _____________________________
Method:
Lab report evaluation and instructor observation during lab sessions.
Outcomes Assessed:
a. Ability to condut experiments as well as to analyze and interpret data
b. Ability to adhere to safety and disciplinary rules
c. Ability to use the techniques, skills and modern engineering tools necessary for engineering practice
Performance Exceeds expectation (5-4) Meets expectation (3-2) Does not meet expectation (1) Marks
Realization Downloads and installs Incapable of selecting relevant
Needs guidance to set up
of required software and sets up software to the experiment and
the system according to the
experiment the system according to the unable to setup the system with
experiment requirements
(a) experiment requirements required software tools
Carries out each procedural Needs assistance or
Conducting step in a satisfactory manner guidance to proceed Unable to carry out procedural
experiment and studies outputs of the through experiment steps, steps and make any useful
(a, c) software application studies outputs with minor observations of outputs
rigorously errors in interpretation
Laboratory
Observes lab safety rules; Observes safety rules and
safety and Disregards lab safety and
adheres to the lab disciplinary disciplinary guidelines
disciplinary disciplinary rules
guidelines aptly with minor deviations
rules (b)
Completes data collection
from the experiment setup by Completes data collection Fails at collecting data by
following procedural steps, with minor error and enters giving proper inputs and
Data
ensures that the data is data in lab manual with observing output states of
collection (c)
entered in the lab manual slight deviation from experiment setup, unable to fill
according to the specified guidelines the lab manual properly
instructions
Analyzes the data obtained Analyzes data with minor
Unable to establish the
from experiment thoroughly error and correlates it with
relationship between practical
Data and accurately verifies it with theoretical values
and theoretical values and
analysis (a, theoretical understanding, reasonably. Attempts to
lacks the theoretical
c) accounts for any discrepancy account for any
understanding to explain any
in data from theory with discrepancy in data from
discrepancy in data
sound explanation theory