-
Notifications
You must be signed in to change notification settings - Fork 0
Architecture
###Class Diagram
client of udp-synchronizer consists of 2 classes and a main program. here is class diagram:
###Activity Diagram
Main program send the orders to server in this way:
###Data Model
Packets are devided into 2 types (Message, Chunk). So what is difference between them?
As mentioned before this program will receive synchronization events from client to sync 2 folders on client and server. Events are create/remove file and create/remove folder. 3 of them only need name of file/folder to create or remove, but to create file we need file contents too. So events are categorized into 2 category (Message and Chunk). Message for create/remove folder and remove file, Chunk for create file. Also we cant send big files in a packet to server so we should split files into several chunks and send the chunks to server. Here is format of chunk and message:
Fields are separate by ;. As you can see first 20 bytes in each of them is checksum. It used for evaluating correctness of the package. After the checksum there is a 2 byte field called type that determine the type of message.
In message type packages there is operation type (one of CREATE_DIR, REMOVE_FILE, REMOVE_DIR) and filename fields after the type field.
In Chunk type packages after the checksum there is file name, start location of the chunk on the file and contents field.
###References
- Bjarne Stroustrup, 2013. The C++ Programming Language. 4 Edition. Addison-Wesley Professional.
- A synchronous UDP daytime client. Available from: http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/tutorial/tutdaytime4.html. [7 Jan 2016]
- Boost Filesystem Library Reference Documentation. Available from: http://www.boost.org/doc/libs/1_60_0/libs/filesystem/doc/reference.html. [13 Jan 2016]