10 years, 5 months ago.

Socket library packet checksums

Maybe that is a silly question, but does this library (Handbook:Socket) do Checksum check for each packet(including data) arriving via UDP/TCP Socket and does it generate a Checksum for packets to send automatically?

Thanks in advance!

Question relating to:

1 Answer

10 years, 5 months ago.

Short answer: Yes TCP, No UDP

All TCP libraries are required to provide guaranteed data delivery. That means that they use checksums and sequence numbers to ensure that the data does not get garbled during transmission.

UDP has no such guarantees. It is up to you to provide whatever data integrity mechanisms you feel are necessary.

These are due to the specifications for the TCP and UDP protocols themselves. It doesn't depend on the hardware or the library in question.