C
C
CloudMonster2014-03-18 21:03:17
PHP
CloudMonster, 2014-03-18 21:03:17

Computer - Server: how to implement file synchronization?

Hello.
The task is this:
Implement in java, php or c++ file synchronization between the user's computer and the user's folder on the server. Ready open-source sync, please do not offer. I would like to learn by myself.
Suppose there is a userfiles folder on the server, which contains user folders whose name is their email
Ex:
userfiles
- [email protected]
- [email protected]
- [email protected]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew, 2014-03-18
@CloudMonster

On one side, you create a list of pairs (hash_name; hash_content) and on the other side, the same list of pairs. One of the parties sends its list to the other party.
The recipient looks for
a) hashes_names that he does not have (and requests such files for himself)
b) hashes_names that the sender does not have (and sends such files to him)
c) hashes_names that are both there and here, but their content_hashes do not match (here you need to decide who has a more recent version and, accordingly, the direction of the exchange)
If the hash is crypto-resistant, then you can still detect the fact of renaming the file - the content_hash will not change, but the name_hash will change. Well, in general, many different questions in terms of reducing traffic between the server and the client can be thought up (for example, some kind of rsync analogy for a list of hashes).

T
Timur Sergeevich, 2014-03-18
@MyAlesya

Well, php usually implement authorization for receiving and storing files.
But in C++ how to scan a folder on a computer and communicate with the server via http.
Since then (

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question