Published on

User Datagram Protocol

💡 What is UDP?

UDP is one of the core protocols of the Internet Protocol Suite, used to send messages called datagrams between computers.

It is part of the transport layer (Layer 4) of the OSI model, just like TCP. But unlike TCP, UDP is connectionless and unreliable—meaning it sends data without establishing a connection or guaranteeing delivery.


🔑 Key Features

FeatureDescription
ConnectionlessNo handshake or setup between sender and receiver before sending data
UnreliableNo guarantee the data will arrive or arrive in order
LightweightMinimal overhead (faster than TCP)
No congestion controlSends as fast as the application allows (can lead to packet loss)

🧱 UDP Packet Structure

A UDP packet (datagram) contains:

  • Source Port
  • Destination Port
  • Length (header + data)
  • Checksum (optional integrity check)
  • Data

📦 Use Cases

Because UDP is fast and doesn't wait for acknowledgments, it’s ideal for time-sensitive or high-speed applications:

  • Streaming media (video/audio)
  • Online gaming
  • VoIP (Voice over IP)
  • DNS (Domain Name System)
  • TFTP (Trivial File Transfer Protocol)

🆚 UDP vs TCP

FeatureUDPTCP
ConnectionNo (connectionless)Yes (connection-oriented)
ReliabilityNo (packets may be lost)Yes (guarantees delivery)
OrderNoYes
SpeedFasterSlower due to acknowledgments
Use CaseStreaming, gamingWeb browsing, file transfer

Let me know if you want a diagram or analogy to help visualize how UDP works!