Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Verifying data integrity

Author
Message
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 25th Jul 2013 20:02 Edited at: 25th Jul 2013 20:11
Hi everyone.
My game will be sending a packet of data to a server after every turn. The size is around 2kb. The turns don't happen very fast (every few minutes at the fastest), but I'm worried about data corruption during the transfer.
Should I be?
What would I do to ensure the integrity of the data?
Should I implement some sort of CRC check?

EDIT
It might be helpful if I tell you that I'm sending the data via post to a php script which updates entries in a MySQL database.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Jul 2013 20:44
What format are you using in the post?

Is it all one string or set up as different values?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 25th Jul 2013 20:48 Edited at: 25th Jul 2013 20:49
i belive the original http post use base64 encode in post for binary data
and start stop markers.
if you have packet loss/interupt connection you get nothing or error in php i think.
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 25th Jul 2013 20:51
In AppGameKit from the SendHTTPRequestASync(oConnectionID , sPage$ , sData$) command the sData$ is all of the data something like this:
p=1&j=2&q=102939312892323021
and so on with one of the post variables (like p above) having an 1800+ character string.
Each is checked with a PHP script using a check_input() function to make sure there's no bad characters that can do commands to the database and such.
Does this answer your question?

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Jul 2013 21:17
You can try doing a check sum with your blocks of data. Compute the check sum before you build the arguments and then make the check sum a separate argument. Maybe put it both before and after the block of data (with different names, of course). Then your first PHP check would be to make sure that those to values matched and then calculate the check sum on the block data and compare to the one that was passed.

That assumes that you are encoding your block data as a string of numbers.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 25th Jul 2013 21:22
That sounds like a decent idea.
Do you think it is necessary though?

Do you think it would be sufficient enough to simply sum the ascii values for every character sent and use that as a checksum or is there a reason to do something more complex?

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Jul 2013 21:28
Any way you want to do the check sum works.

That is the kind of decision best made by the person who knows how it is all going together.

And using the ascii value is as good as any number.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 25th Jul 2013 21:30
Thanks for the info.
I think if I add it in I'll at least have piece of mind.
Yay more work! (thankfully it's not much and probably less work than calming customers who've lost their game data due to a bad data transfer!).
Cheers!

Login to post a reply

Server time is: 2024-11-24 18:49:57
Your offset time is: 2024-11-24 18:49:57