The very idea of dropbox fascinates me. Local-dropbox uses the bandwidth of the home wireless router for transferring large files from one device to another. The idea is to save internet bandwidth by converting one of the spare laptops into a server and using it for auto-syncing files at different workstations(laptops, smartphones, ipod). For instance: Using a dropbox for transferring a movie is not efficient as dropbox will take hours for uploading and syncing(+ it will ask for money :P). A wireless router at home can serve the same purpose along with achieving the minimum possible latency, zero internet bandwidth and highly secure, since no external device is involved.
code - https://github.com/pragya1990/local-dropbox
Used Python IDE and SimpleHTTPServer.
The code is still very raw, but I would still highlight how I went about it:
1) Initial connection : The server remains open at standard HTTP port for receiving messages from the client. The client connects to the server using socket programming and initial control information is exchanged between them such as client_id, client_port_for_file_transfer, server_port_for_file_transfer etc. Standard OK messages are sent if the everything went fine otherwise appropriate error messages are shown.
2) File transfer: I used the SimpleHTTPServer's commands for opening two ports(one at the server and another at the client) for transferring files. The urllib library was used for viewing files at the other end and reading them.
3) Syncing: At the client end, the program continuously checks if the dropbox folder is updated or not. The log file of client and server should be exactly same if no changes has happened on either side. If it needs updation, the client modifies its log file and sends a control message to the server to update its log file as well. The server checks its log file with the client log and downloads/updates the required files. If it is a shared folder, control messages are further sent to the other clients who are sharing the modified folder.
4) Testing: Initially both the client and server are running on the same laptop to make testing easy. Syncing and file updation works perfectly. :)
code - https://github.com/pragya1990/local-dropbox
Used Python IDE and SimpleHTTPServer.
The code is still very raw, but I would still highlight how I went about it:
1) Initial connection : The server remains open at standard HTTP port for receiving messages from the client. The client connects to the server using socket programming and initial control information is exchanged between them such as client_id, client_port_for_file_transfer, server_port_for_file_transfer etc. Standard OK messages are sent if the everything went fine otherwise appropriate error messages are shown.
2) File transfer: I used the SimpleHTTPServer's commands for opening two ports(one at the server and another at the client) for transferring files. The urllib library was used for viewing files at the other end and reading them.
3) Syncing: At the client end, the program continuously checks if the dropbox folder is updated or not. The log file of client and server should be exactly same if no changes has happened on either side. If it needs updation, the client modifies its log file and sends a control message to the server to update its log file as well. The server checks its log file with the client log and downloads/updates the required files. If it is a shared folder, control messages are further sent to the other clients who are sharing the modified folder.
4) Testing: Initially both the client and server are running on the same laptop to make testing easy. Syncing and file updation works perfectly. :)
No comments:
Post a Comment