Sign in to follow this  
Metron

Online Data Update

Recommended Posts

Hi, I'm not quite sure whether yes or no my question fits in here, but here we go : I'm working for a company which has developed some software on PDA. Every now and then data has to be transfered from a server to the PDA and from the PDA to the server. This is different type of data : Exe, XML files, sound files and other stuff. Now, on the server should only be the latest version of the software and data. This means that if the software and data on the server is newer than the one on the PDA, I have to transfer the data from the server to the PDA. If the data (not the software) is newer on the PDA, then I have to transfer it from the PDA to the server. Now here come the problems : - I cannot rely on the date/time stamp of the files because I cannot be sure of the data/time on the server. - I cannot use a trick to determine the current server time (by creating a file and reading it's time) because FTP server access always creates the files in server time and FTP server *do not necessarily* return the year when the file has been created -> thus I cannot time synchronize between the PDA and the FTP server. I've thought of keeping an XML file with the current version of the files (one on the server for the server versions and one on the PDA for the version info on the PDA), but I run into the problem that someone *could* copy by hand files from A to B and thus the version info would be false. Does anyone have an idea on how I could solve my problem ? I thought I could use some technics from the MMOGs but they do not face the same problem since the data update only goes from the server to the clients and not vice versa. Best regards, Metron

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I presume the plan is synchronisation between directories.

You could maintain the current version number in some form (xml etc) on both the client and server, each with the CRC of the file the last time it was updated.

Then, on an update, you can check the CRCs against the actual files to see if they've been changed. If so then you can bump the version number on the local copy.

Then you send the local version number and CRC to the server and compare the version numbers, obviously if the servers is greater you send to the client, and vice-versa.

In the event of a tie you compare CRCs and do nothing if they are identical, but if they differ you are going to have to ask the user what to do (unless you can insist either that the server or clients copy should be definitive). This is a very domain specific UI thing

Share this post


Link to post
Share on other sites
If you can control the modification and/or protocols used, then you can detect changes, rather than actual times.

Thus, on the PDA, store the time the server file had LAST time, in a list somewhere. When connecting next time, compare the file time to the stored time, and see if they changed.

You can do a similar thing for files going the other direction; store the last sync time on the PDA, and if the PDA file time is different than the last sync time, sync.

Also consider what to do if the same file changes both on the server and the PDA between two syncs.

Share this post


Link to post
Share on other sites
Hi,

thanks for your replies. I've thought about that file containing some kind of description for the files managed by the update system, too. The major lack I see with this solution is, that any user could simply invalidate the process by copying by hand some files around without updating the xml file.

anyways, what you mentioned was one of the solutions I'm proposing to my company today. Other ones are : Using a database (SQL, CVS) to manage the files, enhance our own database interface and/or write our own update server and impose it to our clients ("we need this if you want to use our update service").

You can read my journal to get an idea what is happening :)

Share this post


Link to post
Share on other sites
Quote:

any user could simply invalidate the process by copying by hand some files around without updating the xml file


I don't think you understood my proposal. The file only contains the time stamps which the PDA HAS SEEN. The actual time stamps comes from the file modification date of the file itself on the server (or on the PDA).

This approach is capable of detecting both files changing on the server, because the timestamp you get from the server won't be the same as in your local reference file, AND files changing on the PDA without you knowing it, because the local file modification time won't be the same as stored in the reference file.

And if someone deletes the reference file (that your software creates and maintains, on the PDA), then you can assume everything is old and re-fetch everything from the server.

This approach is very robust -- assuming you have a way of getting a list of files with server modification times from the server, which seems to me to be a fairly safe assumption.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this