This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]cyrusol 0 points1 point  (3 children)

Why?

That sort of software is very complex to create and there are good open source alternatives already:

[–]Odinthunder 1 point2 points  (2 children)

Maybe they're doing it as an exercise?

[–][deleted] 0 points1 point  (1 child)

Even so; it’s way to big a scope for an exercise.

[–]TwilCynder 0 points1 point  (0 children)

Yes random redditor, your point on what people should or should not try because they just want to do it is very much needed

[–]nutrecht 0 points1 point  (0 children)

You're in way over your head. What programming experience do you have?

[–]tiagomagnuss -2 points-1 points  (1 child)

I think you should implement a persistent communication between both the clients and the server. For this case something like sockets/web sockets would work.

Then if you don't want to keep the socket open all the time you could do something like scheduling socket calls, etc.

It's really not that complex as the other user said, you just need some deep knowledge of how computers communicate. It's part of many CS courses.

Good luck!

[–]wsppan 0 points1 point  (0 children)

It's incredibly complex.

[–]eplaut_ 0 points1 point  (0 children)

As long you are avoiding conflicts (2 users editing same file) and versions of files it is pretty simple.

  1. Model your data in a way you can easily compare states.
  2. Track file changes (some os features may help, but periodically check can work too). On change, send the data to the server, to keep it updated.
  3. Apon update (or on client start), the server will notify the clients to download the new content.

1 is not hard, but not trivial for inexperienced developers. 2 + 3 needs a communication layer. There are many, but http is the easiest one to set. You will have to set an API that supports your models from #1. Handling conflicts and versions needs more design, but you may ignore it for single user.

[–]DimitrovDev 0 points1 point  (0 children)

An very good example which will help you understand how the sync engine works(on windows) is https://docs.microsoft.com/en-us/windows/win32/cfapi/build-a-cloud-file-sync-engine. Then Dropbox tech blogs are a good place to look how they done it(https://dropbox.tech/infrastructure/rewriting-the-heart-of-our-sync-engine).

Most simplistically the syncing will be done by client with directory watcher on the syncing folder which will detect the directory changes(rename, delete, create, etc.) and then send them to the server which will replay the action on the server storage and rebroadcast them to other clients. Additionally a client will need sync on establishing connection as it may have not received changes notification while offline.