Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I want to create my own Dropbox clone (for learning purposes - only the Windows app) and am looking for some tips.

Currently, I use the FileSystemWatcher to check if there's a change, then use rsync to sync all the data. Now, how does this work with multiple computers? If computer A changes a file, it should be pushed to computer B (and vice versa).

My questions are:

  • Do I need to create a push notification system or are there (better) alternatives so I know if data has to be pulled (as in a file has changed on the server)?
  • Dropbox has the green tick and a blue sync icon. How can this be done? How do I know which files are being uploaded/downloaded (if rsync-ing the whole directory)?
share|improve this question

migrated from stackoverflow.com May 27 '12 at 3:02

This question came from our site for professional and enthusiast programmers.

1  
FileSystemWatcher is unreliable, you may want to also use a timer or another event as a backup. –  Amicable May 21 '12 at 12:43
    
@MikeMiller "Open ended question and mostly opinion based" means it's not a good fit for Stack Exchange in general, so no, this shouldn't be on Programmers. –  Yannis Rizos May 26 '12 at 15:12
2  
read up on the NTFS Change Journal, which is far superior to the FileSystemWatcher for monitoring files on NTFS volumes –  Ben Voigt May 27 '12 at 3:08
    
or - for now - just scan the whole folder every minute. –  user1249 May 27 '12 at 8:34

2 Answers 2

Do I need to create a push notification system?

This is one solution. I am sure there are many that would do what you want.

Are there (better) alternatives so I know if data has to be pulled (as in a file has changed on the server)?

Define "better" you should keep track of which files have been updated. This requires you keep multiple versions and your system will always grab the most recent version unless another version is requested.

Dropbox has the green tick and a blue sync icon. How can this be done? How do I know which files are being uploaded/downloaded (if rsync-ing the whole directory)?

How can you implement what exactly? When your system detects a new version of a file on the local system create a new versions on the server before you upload the file.

It sounds like you need to think about how this system is going to work before you proceed.

share|improve this answer
  • You can do a push notification about file update OR you can set some timer on client to periodically check for file updates, and pull it if necessary. If you are dependent on timers, you may have to wait a while before the update happens. You have to do something like download-if-newer followed by file-id and its last-update-time.

  • You have to keep time stamps/or hash values of last updates for each file. Client will also have last update time stamp/hash value. If the time stamp is newer/hash different on server, you will know that the file on server is newer. If you are using time stamps, make sure its some global time value of server side.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.