I recently developed a multiplayer online game and it works great. There, the central server handles TCP connections with clients, and they both receive and send data.
Is there a way to verify that the data sent has not been changed before the receiver reads it?
Is a TCP connection connected to it? If not the best way (don't ask for code) to implement it?
So far, I have come up with these ideas:
- Modify the data sent by adding some kind of confirmation value, such as the length of the packet.
- When the packet is received, ask the server to send it again and check if they are equal.
I was looking for a common solution used, but could not find much.
Encryption should be my last option.
Edit
For an easy way to achieve this:
source share