Testing Integrity of a Packet

I already know how to send information across a network, but I'm not quite sure on how to make sure that the information sent is correctly since I'm using UDP. Here are my current ideas:

-Parity of the Information
One of my thoughts was to send every message with the same parity, and test the parity when the message is received on the client. If the parity is wrong, then have the server send another message. While this would ensure at least some of the corrupted packets to be detected, there's still room for error.

-Information Mode
My other thought was to send 3-7 packets of the same information and have the client use the mode of the information. This would be much more secure, but it might take longer. Also, there's still a small chance that all of the packets would be corrupted, and the information would be wrong anyways.

What would be the best one? Or would neither be the best way to check integrity?


Then again, what are the chances of the packets getting corrupted? I'm guessing it would depend on how far the packet traveled and the quality of the connections. Is it even worth testing the integrity?
Last edited on
Are you talking TCP/IP using a TCP (as apposed to a UDP) socket?
If so then there is no need for all this extra checking and stuff
I'm using UDP, not TCP/IP. I thought I mentioned that, sorry. I'll edit the post.
UDP has a 16-bit checksum feature which is enabled by default. Is this not sufficient?
But couldn't the checksum itself be corrupted? Or would the packet just never reach its destination if this happened?
You could have a look at hamming code which uses several parity bits if you really want to delve into error checking
You can't tell the difference between a corrupted checksum in an otherwise valid packet, a valid checksum
in an otherwise corrupt packet, or a corrupted checksum in a corrupted packet, but in any case you'd want
to drop the packet anyway.


That's what I thought, I just wasn't sure if a packet would be redirected because of a corrupt checksum. Thanks.
Topic archived. No new replies allowed.