We know that IPv4
header has checksum for header not for data .Therefore for checking data error we need checksum in transport layer. Suppose we're using UDP
in layer 4.
So if I remove the checksum option from UDP
datagram how error will be detected? Or My question is why UDP
checksum is optional for IPv4
?
-
2"Therefore for checking data error we need checksum in transport layer." No, an application or application-layer protocol can implement error checking on the application data.– Ron Maupin ♦Sep 11, 2021 at 22:27
1 Answer
That's just the way it is designed. You can use a checksum but you don't need to.
The application might not care so much about data corruption or your application-layer protocol might include a much better integrity check than UDP's very simple checksum. Also, there may be scenarios where it is preferrable to receive anything rather than nothing at all.
Using no checksum in the UDP header can also be a benefit - since datagrams failing checksum verification are simply dropped, the receiving application doesn't get to see them.
By explicitly not using the checksum option, the sender application can have damaged datagrams delivered to the receiver application just the same. Now, if the sender application also includes forward error correction (FEC) information in the UDP payload (on the application layer), that allows the receiver application to repair damaged data and receive correct data after all.
-
-
after receiving damaged data in receiver side, receiver repairs data in its application layer?– S. M.Sep 14, 2021 at 9:30
-
If the application provides forward error correction, it's got the chance to repair damaged UDP data. If the UDP checksum option is used, damaged datagrams are dropped before reaching the application and there's no chance for repair.– Zac67 ♦Sep 14, 2021 at 11:47
-
-
Reed-Solomon is a common FEC code, or more generally, any Hamming code. I'm afraid, the details are off-topic here, but could be explored on Stack Overflow.– Zac67 ♦Sep 14, 2021 at 11:56