7

The User Datagram Protocol provides some error detection.

Someone says that it has checksum mechanics. But this protocol does not have a hand shaking process. So this protocol does not seem to worry about the data errors.
How can it have a checksum part?

Manjitha Teshara
  • 562
  • 2
  • 8
  • 21

1 Answers1

7

Checksum has nothing to do with handshake. It simply validates integrity of a packet being transmitted. If packet is invalid, it will be discarded. In case of TCP, receiver (or rather a next hop router) will try to recover by asking sender to re-send invalid packet. But in case of UDP, it simply ends right there - packet is simply discarded and that's it. Beware though that UDP checksum is actually optional. And I believe can even be removed by an intermediate hop router. It's also a pretty weak checksum even if used.

In general, modern day "common wisdom" says that on modern equipment packets rarely get corrupted in transmission. And if you're ok with that assumption, then I'd suggest simply assume that packets are never corrupted ignoring whether checksum was used in transition or not. But if you aren't ok with occasional data corruption, then you should rather embed a better checksum into your data, such as a CRC or even a cryptographic hash. It all depends on how important data integrity is for you and how far you are willing to go to achieve it. And that actually applies to TCP as well as to UDP.

See RFC and also this answer.

Seva
  • 2,388
  • 10
  • 9
  • Thanks for respond, TCP use full for reliable and connection-oriented connection,But UDP provide unreliable,connection-less and data-gram-oriented transport layer protocol.UDP send data send much as possible.some time UDP more use full than TCP. – Manjitha Teshara Jul 17 '18 at 16:24