Kamran Mushtaq
Back to Networking
Networking

Datagram

Added: June 19, 2026Nurtured: June 20, 2026

Definition

A Datagram is the Protocol Data Unit (PDU) at the Transport Layer (Layer 4) when using UDP (User Datagram Protocol), formed by combining Application Layer data with a UDP header.

What Problem It Solves

It allows data to be sent quickly between applications without establishing a connection, while still using port numbers to deliver data to the correct process.

What Happens If Not Used

Without datagrams, UDP would not be able to package data with essential addressing (ports), making fast, lightweight communication impossible for real-time applications.

Easy Wording

A datagram is data wrapped with UDP information that is sent quickly without setting up a connection.

Layman Example

It’s like sending a postcard instead of a registered letter—you just write and send it without waiting for confirmation.

Technical Example

At Layer 4 (UDP):

  • Application data (Layer 5) is taken
  • UDP adds a header containing:
  • Source port
  • Destination port
  • Length
  • Checksum The result is called a UDP Datagram, which is then passed to the Internet Layer for routing. Used in applications like:
  • DNS queries
  • Video streaming
  • Online gaming
  • Voice calls (VoIP)