According to Java Network Programming, UDP's data checksum feature is "optional and not used in or accessible from application layer programs". Since it's optional and I can't tell whether it was used, isn't an invisibly optional checksum no better than no checksum at all, from my program's point of view? What's your experience: do you include your own application-level checksums in UDP packets? Are you seeing any corrupted packets?

That's what I thought too, but if checksums are optional, then maybe the sender's transport layer didn't use them and hence you can't be sure your data's not corrupted. To be able to rely on corrupted packets being dropped, you'd need to be sure that the sender's transport layer uses the optional checksums. This could be especially tricky if the sender is a MIDP 2.0-enabled mobile phone: it's very hard to find out about their UDP protocol implementations.

I don't think it'd be a Java issue really, more a platform issue. If their passing data backup to the application layer that could potentially be corrupted the implementation doesn't match what UDP is meant to do.

I'm not saying this isn't the case, but that if it is you'd need to take it up with the hardware/platform manufacturer.

On PC type hardware I've never recieved any corrupted packets, but I think thats the contract between UDP and the application layer.

A little Googling turns up that SunOS at least used to have UDP checksums switched off to speed up its NFS implementation. However, RFC 1122 'Requirements for Internet Hosts' says that they must default to being on, so maybe the problem no longer exists. My general impression is that you're only supposed to switch it off when using highly reliable networks (and typically LANs), but that protocol implementors have been somewhat inconsistent about this in the past. The Wikipedia entry on UDP says that UDP checksums are "almost always used in practice", and that matches what an hour or so of Google-research turned up.

Oh well, I'll just assume for now that it's always used, but keep this in mind if I get puzzling bugs...

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org