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

Transport Udp Error Detection

The document provides an overview of the User Datagram Protocol (UDP), highlighting its connectionless nature and best-effort service, which allows for potential data loss, corruption, or reordering. It explains the structure of UDP segments, the process of error detection using checksums, and the limitations of this method in ensuring reliable data delivery. UDP is presented as a lightweight transport option suitable for applications that can tolerate some data loss, such as video calling and DNS.

Uploaded by

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

Transport Udp Error Detection

The document provides an overview of the User Datagram Protocol (UDP), highlighting its connectionless nature and best-effort service, which allows for potential data loss, corruption, or reordering. It explains the structure of UDP segments, the process of error detection using checksums, and the limitations of this method in ensuring reliable data delivery. UDP is presented as a lightweight transport option suitable for applications that can tolerate some data loss, such as video calling and DNS.

Uploaded by

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

CS 352

User Datagram Protocol

CS 352, Lecture 8.1


http://www.cs.rutgers.edu/~sn624/352

Srinivas Narayana

1
Transport

Application HTTPS FTP HTTP SMTP DNS

Transport TCP UDP

IP
Network

802.11 X.25 … ATM


Host-to-Net
Modularity through layering

Apps: useful user-level functions HTTP FTP NV TFTP

TCP UDP
Transport: provide guarantees to apps
IP

Network: best-effort global pkt delivery Ether ATM … WiFi

Link: best-effort local pkt delivery


UDP: User Datagram Protocol [RFC 768]

• Best effort service. UDP Why are UDP’s guarantees even


segments may be: okay?
• Lost Simple & low overhead compared to
• Delivered out of order to app TCP:
• No delays due to connection
• UDP is connectionless establishment
• Each UDP segment handled • UDP can send data immediately
independently of others (i.e. no • No memory for connection state at
“memory” across packets) sender & receiver
• Suitable for one-off req/resp • Small segment header
• E.g., DNS uses UDP • UDP can blast away data as fast
• Also for loss-tolerant delay- as desired
• UDP has no “congestion control”
sensitive apps, e.g., video calling
Length of
UDP segment structure segment
(header + data)

Applications 16 bits 16 bits Error


detection
source port # dest port # info
Transport (more to
length checksum come)

Network application
data
(message)
Link layer
UDP segment structure

Source IP address
Applications Destination IP address

source port # dest port #
Transport
length checksum

Network application
data
(message)
Link layer
Review: UDP demultiplexing

Port 1 Source IP address
Port 2
IP 1 1
Machine
Destination IP address
… …
… source port # dest port #

Machine
Port144262 length checksum

Port 65535
application
IP 2 1
Machine
data
socket() Ports (message)
UDP packets
• A small demo
CS 352
UDP: Error Detection

CS 352, Lecture 8.2


http://www.cs.rutgers.edu/~sn624/352

Srinivas Narayana

10
UDP: Best Effort Service
• Simple and low overhead transport: connectionless
• Data may be lost
• Data may be corrupted along the way (e.g., 1 -> 0)
• Data may be reordered
• However, simple error detection is possible.
UDP Error Detection
• Key idea: have sender compute a function over the data
• Store the result in the packet
• Receiver can check the function’s value in received packet

• An analogy: you’re sending a package of goodies and want


your recipient to know if goodies were leaked along the way

• Your idea: weigh the package; stamp the weight on the package
• Have the recipient weigh the package and cross-check the weight with
the stamped value
Error detection function
• Function must be easy to compute
• Function must capture the likely changes to the packet
• If the packet was corrupted through these likely changes, the function
value must change
• Function must be easy to verify

• UDP uses a function called a checksum


• Very common idea: used in multiple parts of networks and computer
systems
UDP Checksum
Sender: Receiver:
• treat segment contents as • compute a checksum of the
sequence of 16-bit integers received segment, including
• checksum: addition (1’s the checksum in packet itself
complement sum) of segment • check if the resulting
contents (computed) checksum is 0
• sender puts checksum value • NO – an error is detected
into UDP checksum field • YES – assume no error
Computing 1’s complement sum
• Very similar to regular (unsigned) binary addition.
• However, when adding numbers, a carryout from the most
significant bit needs to be added to the result
• Example: add two 16-bit integers
1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1

sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1

15
From the UDP specification (RFC 768)
• Checksum is the 16-bit one's complement of the one's
complement sum of a pseudo header of information from the IP
header, the UDP header, and the data, padded with zero octets
at the end (if necessary) to make a multiple of two octets.

• The pseudo header conceptually prefixed to the UDP header


contains the source address, the destination address, the
protocol, and the UDP length.
Some observations on checksums
• Checksums don’t detect all bit errors
• Consider (x, y) vs. (x – 1, y + 1) as adjacent 16-bit values in packet
• Analogy: you can’t assume the package hasn’t been meddled with if its
weight matches the one on the stamp. More smarts needed for that. 
• But it’s a lightweight method that works well in many cases

• Checksums are part of the packet; they can get corrupted too
• The receiver will just declare an error if it finds an error
• However, checksums don’t enable the receiver to detect where the error lies
or correct the error(s)
• Checksum is an error detection mechanism; not a correction mechanism.
Some observations on checksums
• Checksums are insufficient for reliable data delivery
• If a packet is lost, so is its checksum

• UDP and TCP use the same checksum function


• TCP also uses the lightweight error detection capability
• However, TCP has more mature mechanisms for generally reliable data
delivery (lots more to come on this)
Playing with checksums
• A small demo
Summary of UDP
• UDP is a thin shim around network layer’s best-effort delivery
• One-off request/response messages
• Lightweight transport for loss-tolerant delay-sensitive applications

• Provides basic multiplexing/demultiplexing for application


• No reliability, performance, or ordering guarantees
• Can do basic error detection (bit flips) using checksums
• Error detection is necessary to deliver data reliably but it is insufficient

You might also like