Why does UDP have a checksum?

bmunroebmunroe Member Posts: 16 ■□□□□□□□□□
In my "noobiness", I've understood that UDP does not perform any error detection or notification. If it is an unreliable/connectionless protocol, what does it use the Checksum field for?

Thanks

Comments

  • remyforbes777remyforbes777 Member Posts: 499
    UDP is connectionless which means that it doesn't care about dropped packets and packets received out of order, it is a best effort protocol but it does care about the integrity of the packets it receives. This is why it has a FCS. It checks the header and data of the packet.
  • dynamikdynamik Banned Posts: 12,312 ■■■■■■■■■□
    Yes. You are mistaken that it doesn't provide error detection. It provides error detection; not error recovery.
  • aragoen_celtdraaragoen_celtdra Member Posts: 246
    dynamik wrote:
    Yes. You are mistaken that it doesn't provide error detection. It provides error detection; not error recovery.
    I would like to second that icon_wink.gif

    Just make sure you understand the difference between error recovery and error detection when thinking about these two terms. They are not the same.

    Error detection.. well, detects an error that occurs on the frame. FCS does the trick.

    To add on to Remyforbes, Error recovery uses sequencing to determine if there is an error in the frame sent, and if there is, it asks to be resent, which completes the "recovery" process.

    So remember: Error detection vs. Error recovery.
    CCIE Wr: In Progress...
    Hours CCIE Wr Prep: 309:03:52
    Follow my study progress at Route My World!
    My CCIE Thread
  • bmunroebmunroe Member Posts: 16 ■□□□□□□□□□
    Works for me. But just to make sure I'm clear; UDP detects errors via the Checksum/CRC/FCS, but it does nothing about them? And if this is the case, what is the point of error detection if no action will be taken? Please don't take this as an argument that UDP performs "correction", because I certainly don't believe this to be the case. I understand that this is only available to TCP. I was just suprised to see that UDP packets seem to have the means to "detect" errors, but (if I'm understanding correctly) do nothing about the errors.
  • aragoen_celtdraaragoen_celtdra Member Posts: 246
    bmunroe wrote:
    Works for me. But just to make sure I'm clear; UDP it detects errors via the Checksum/CRC/FCS, but it does nothing about them? And if this is the case, what is the point of error detection if no action will be taken?
    Uh oh! Anybody else want to help? icon_lol.gif
    Ok i just passed my CCENT so I know some of the whats and the hows.. but never thought about the whys. Hahaha..

    But good question.. something I never thought about. Well let's see.. if a packet is an error, it gets discarded, so it's not used. I would guess that if it is not detected as an error, the packet is not dropped and it is accepted by the receving device. So if there is no way to detect an erroneous packet, all packets gets through the device.

    Can anyone confirm my logic? Sorry bmunroe, i'm still trying to understand too. But watch someome will know for sure.. you just wait... ;)
    CCIE Wr: In Progress...
    Hours CCIE Wr Prep: 309:03:52
    Follow my study progress at Route My World!
    My CCIE Thread
  • sir_creamy_sir_creamy_ Inactive Imported Users Posts: 298
    bmunroe wrote:
    Works for me. But just to make sure I'm clear; UDP detects errors via the Checksum/CRC/FCS, but it does nothing about them? And if this is the case, what is the point of error detection if no action will be taken? Please don't take this as an argument that UDP performs "correction", because I certainly don't believe this to be the case. I understand that this is only available to TCP. I was just suprised to see that UDP packets seem to have the means to "detect" errors, but (if I'm understanding correctly) do nothing about the errors.

    "UDP has an optional checksum. Packets with wrong checksums are discarded."

    "TCP has a checksum of the payload, TCP header (excluding the checksum field) and source- and destination addresses of the IP header. Packets found to have incorrect checksums are discarded and eventually get retransmitted when the sender receives a triple-ack or a timeout occurs. "

    http://en.wikipedia.org/wiki/Error_correction

    The action taken is that the packet is dropped.
    Bachelor of Computer Science

    [Forum moderators are my friends]
  • GoldmemberGoldmember Member Posts: 277
    Why does any message have a checksum?

    Integrity.

    or as stated before

    Error Detection

    The same thing.
    CCNA, A+. MCP(70-270. 70-290), Dell SoftSkills
  • bmunroebmunroe Member Posts: 16 ■□□□□□□□□□
    I really appreciate all the posts, but sir_creamy's comments cleared up my confusion. I understood the "what" of error detection, but not the "why".

    In essence...

    "[UDP] packets with wrong checksums are discarded."
    "The action taken is that the packet is dropped."

    Perfect. TCP detects AND recovers. UDP detects but discards. I was under the mistaken impression that UDP forwarded the frame, warts (errors) and all. Not so.

    Thanks to everyone for you patience and help.

    -bmunroe
  • darkuserdarkuser Member Posts: 620 ■■■□□□□□□□
    it's simple
    udp is "best effort"
    ie
    if you at first dont succeed try try again.
    the checksum is a data integrity check.
    or a sanity check for the data packet itself

    tcp has error correction built in
    by using sequence numbers.
    rm -rf /
  • dynamikdynamik Banned Posts: 12,312 ■■■■■■■■■□
    It also helps to think of the purposes for each protocol. UDP is used for things like voice, video, online gaming, etc. It has lower overhead and the data isn't critical. If you do lose a packet that's a few milliseconds of voice or video, there's no point in trying to retrieve because the time it would have been useful has already passed. TCP should be used for things like credit card transactions where you need to be sure that all the data arrives intact. You couldn't process an order with just 14 of the 16 numbers.

    So yes, UDP just silently discards corrupted data because there is no point in trying to do anything else with it.
  • shednikshednik Member Posts: 2,005
    darkuser wrote:
    it's simple
    udp is "best effort"
    ie
    if you at first dont succeed try try again.
    the checksum is a data integrity check.
    or a sanity check for the data packet itself

    tcp has error correction built in
    by using sequence numbers.

    There it is plain and simple :D
  • GlynixxGlynixx Member Posts: 138
    Hi all.

    Also to just add a few more thoughts with regards to the whys, there are specific reasons why you would actually want to use UDP vs TCP:
    1. its smaller
    2. if you are online gaming, doing voip or doing video conf. you do not care about a dropped packet here or there. You do not want to see that packet retransmitted because that part of the conversation or gaming action is already in the past, you just care about what is "live" at that moment in time.

    At least this is what my studies tell me :D

    Hope all is well.
    Check out www.manager-tools.com for some great management training for free!
  • bmunroebmunroe Member Posts: 16 ■□□□□□□□□□
    Thanks for all the great responses! Great community. :D
  • PashPash Member Posts: 1,600 ■■■■■□□□□□
    Nice to see you asking the right questions bmunroe. I would also suggest (if you havent already) to download Wireshark and start checking out traffic on your network. It will display all the packet information sent on the wire with detail explanation of what is contained within.

    It helps a lot.

    Cheers,
    DevOps Engineer and Security Champion. https://blog.pash.by - I am trying to find my writing style, so please bear with me.
  • sir_creamy_sir_creamy_ Inactive Imported Users Posts: 298
    In case anyone is interested in yet another explanation:

    "Although UDP provides error checking, it does not do anything to recover from an error. Some implementations of UDP simply discard the damaged segment; others pass the damaged segment to the application with a warning"

    - Computer Networking: A top-down approach
    Kurose, Ross

    On a somewhat unrelated note, I think this textbook sucks. WAAAYYY too many analogies and fluff. Does anyone have a tried-and-true book on networking theory that explains things in a no-nonsense fashion?
    Bachelor of Computer Science

    [Forum moderators are my friends]
  • sir_creamy_sir_creamy_ Inactive Imported Users Posts: 298
    Ooooo, and one more thing...

    You may be asking yourself why UDP has a checksum if the link-layer also provides error checking. One reason is that there is no guarantee that the link-layer protocol uses error checking. Some links may use a protocol supporting error checking while others may not.

    Also, a segment can obtain bit errors while it sits in a router's memory, so UDP has to provide error detection on an end to end basis. This follows the end-to-end principle:

    http://en.wikipedia.org/wiki/End-to-end_principle
    Bachelor of Computer Science

    [Forum moderators are my friends]
Sign In or Register to comment.