Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to verify data integrity between client-server connection?
    text
    copied!<p>I recently developed an online multiplayer game and it's working fine. There's a central server handling TCP connections with clients, and they both receive and send data.<br> Is there a way to verify that the data sent hasn't been modified before the receiver reads it?<br> Does a TCP connection handle it in some way? If not what is the best way (not asking for code) to implement it?<br> By now I came up with those ideas:</p> <ul> <li>Modify the data sent adding some sort of verify-value, such the packet length.</li> <li>When a packet is received, ask the server to send it again and verify if they are equal.</li> </ul> <p>I searched for a common used solution but couldn't find much.<br> Encryption should be my last option.</p> <p><strong>Edit</strong><br> For a simple way to achieve this:</p> <ol> <li>MD5<br> <ul> <li><a href="http://en.wikipedia.org/wiki/MD5" rel="nofollow noreferrer">Wikipedia</a><br></li> <li><a href="https://stackoverflow.com/questions/415953/generate-md5-hash-in-java">Example</a></li> </ul></li> <li>SHA1<br> <ul> <li><a href="http://en.wikipedia.org/wiki/SHA-1" rel="nofollow noreferrer">Wikipedia</a><br></li> <li><a href="http://anyexample.com/programming/java/java_simple_class_to_compute_sha_1_hash.xml" rel="nofollow noreferrer">Example</a></li> </ul></li> <li>SSL<br> <ul> <li><a href="http://en.wikipedia.org/wiki/Transport_Layer_Security" rel="nofollow noreferrer">Wikipedia</a><br></li> <li><a href="http://stilius.net/java/java_ssl.php" rel="nofollow noreferrer">Example</a></li> </ul></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload