TheHingineer

  • Computer Networks


  • CN Part-1

  • CN Part-2

  • CN Part-3

  • CN Part-4

  • CN Part-5

  •  UDP (User Datagram Protocol): Format and Features in Computer Networks

     UDP kya hai? (What is User Datagram Protocol?)

    • User Datagram Protocol (UDP) Transport Layer ka ek lightweight, connectionless aur extremely fast protocol hai jise RFC 768 dwara define kiya gaya tha.

    • TCP ke opposite, UDP “Send and Forget” (Fire and Forget) principle par kaam karta hai. Isme na koi 3-way handshake hota hai, na flow control, aur na hi koi error recovery mechanism.

    • Agar koi packet network par lost ho jaye, toh UDP na uski parwah karta hai aur na hi use dubara bhejta hai.

    • Toh fir UDP kyu use hota hai?
      Speed aur Low Latency ke liye! Online multiplayer gaming (BGMI, CS), live video streaming (YouTube Live, Hotstar), aur voice calls (VoIP/Zoom) mein 100% data reliability se zyada important real-time delivery hoti hai. Agar live video ka ek frame miss ho jaye, toh purane frame ko retransmit karne se stream freeze ho jayegi jo bilkul unacceptable hai.

     1. UDP Datagram Format

    UDP header bohot compact aur simple hota hai. Iska size fixed 8 Bytes (64 bits) hota hai:

     0                   1                   2                   3
     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |          Source Port          |       Destination Port        |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |            Length             |           Checksum            |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                                                               |
    |                        Data (Payload)                         |
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    Field Size Purpose aur Description
    Source Port 16 bits (2 Bytes) Sending application ka Port number. Optional hota hai (agar reply ki zaroorat na ho toh 0 set kar sakte hain).
    Destination Port 16 bits (2 Bytes) Receiving application process ka Port number (Mandatory).
    Length 16 bits (2 Bytes) Poore UDP packet ka total size bytes mein (UDP Header [8B] + Data Payload). Minimum length 8 Bytes hoti hai (jab data empty ho).
    Checksum 16 bits (2 Bytes) Error detection ke liye. IPv4 mein Checksum optional hota hai (0 ka matlab no checksum), lekin IPv6 mein mandatory hota hai.

     Key Features of UDP

    -> Connectionless: Koi handshaking ya connection setup delay nahi hota. Data turant chala jaata hai.
    -> Low Overhead: Sirf 8 bytes ka header (jabki TCP ka minimum 20 bytes hota hai). Isse network bandwidth save hoti hai.
    -> No Flow and Congestion Control: UDP sender channel capacity ya receiver speed dekhe bina full speed par packets send karta hai.
    -> Message-Oriented (Preserves Boundaries): Application jitne size ka chunk bhejti hai, UDP exactly utna hi datagram banata hai (unlike TCP jo continuous byte stream ki tarah data tod deta hai).
    -> Broadcast and Multicast Support: TCP sirf 1-to-1 (Unicast) support karta hai, jabki UDP Unicast, Multicast, aur Broadcast teeno smoothly support karta hai.

     When to Use UDP? Popular Applications

    • DNS (Domain Name System – Port 53): Single query and single response application. 3-way handshake ka extra overhead DNS ko bohot slow bana dega.

    • DHCP (Dynamic Host Configuration Protocol – Port 67/68): Broadcast communication use karta hai jo TCP mein possible nahi hai.

    • SNMP (Simple Network Management Protocol): Network routers aur switches ki health monitoring.

    • VoIP & Video Conferencing (RTP Protocol): Real-time audio/video transmission.

    • Online Gaming: Fast player positions updates jahan purane packet ki koi value nahi hoti.

     TCP vs UDP Detailed Comparison (Exam High-Yield!)

    Feature TCP (Transmission Control Protocol) UDP (User Datagram Protocol)
    Connection Connection-oriented (3-way handshake). Connectionless (No setup phase).
    Reliability Guaranteed delivery (ACK & Retransmissions). Best effort (No ACK, packets can be lost).
    Header Size 20 to 60 Bytes. Fixed 8 Bytes.
    Data Nature Byte Stream. Message Oriented (Datagram boundaries preserved).
    Transmission Speed Moderate / Slower. Extremely Fast.
    Broadcast / Multicast Not supported (Only Unicast). Supported (Unicast, Multicast, Broadcast).

     Summary Table

    Aspect Summary
    Header Size Fixed 8 Bytes (Source Port, Dest Port, Length, Checksum).
    Core Strength Minimum latency and zero connection overhead.
    Primary Use DNS, DHCP, Live Audio/Video streaming, Online Gaming.
    Scroll to Top