Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Update Detection

 
Persio Berberian
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a program that try to detect any of its files updates(Datas), because some updates are necessary to make the program work correctly, well for long time I've been comparing the last change of File in my FTP With the user File in his System.
Well but that way is kindly complicated, because if FTP Update for some reason, all files are going to be updated for the user(Also some users experienced problems, like not finding updates), then I decided to make a new system and started with a file checksums comparator, well it take (UserFile CheckSum, then take URL File Checksum) and compare each other, well it works but the problem is that I have to compare the same amount of bytes, and to make 100% sure that the file is the same I have to compare the whole file, and to compare the Whole File from URL Take too much time to do in each program startup, and without some updates the program may crash so those are important.

So... I'm here to ask you a suggestion on how I Could make a decent file updater
I'm trying to avoid store each file version in files or something like that...
Thanks =D

Edit: What I was thinking, is write all files CheckSum in a file, then user when startup program and check file and read all checksums and compare them ^^ The bad thing of that is... That on every update I gotta create a new list of CheckSums ^^
Or I could make it connect to a server that will send the list of checksums ^^ but that's a bit annoying ;/
 
Rob Spoor
Sheriff
Pie
Posts: 20669
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're using Java 7 you can use java.nio.file.WatchService for this.
 
Persio Berberian
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well but this WatchService is a listener for local files, I need a listener for files in my FTP, because client is supposed to download updated files ^^
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't your FTP client software give you a way to find the last changed date of a file on the server? Using that date would be easier than using a checksum.
 
Persio Berberian
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said that's what I'm doing for loong time, checking last file changed date, but that way is not good.
Oh well then you agree with me about make an Update Server :p
As I said, I don't like the "last changed" way to make those updates, if I make an update server I can compare by checksum as the server will send checksums instead of client read them from file itself :p
PS: Still searching for more suggestions :p
 
Campbell Ritchie
Sheriff
Pie
Posts: 50273
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too difficult for “beginning”. Moving thread.
 
Persio Berberian
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, maybe I'll get more opinions, by the way I already created my Update Server, when client login it open connection to update server then send a packet asking for all file checksum, then server parse packet and send the checksum that are stored in a list that refresh every 20 seconds, then client compare each checksum received that come with filename, with local computer files, if there are any file with different checksum the client will send another packet requesting the download of file that's different :p, then server will parse this packet and send file to client :p What about?




But I'm crazy for more suggestions, because Idk... what if update server become off-line I need an optional way :p
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic