CS3103 P2P Project
-
Calculate checksums of each file in
directory
. If it's not our custom extension, we treat that as a complete file (i.e. Peer has all the chunks). If it's in our.chunk
format, we know that it is an incomplete file. We have to parse the set of.chunk
files we have rather than justmd5
ing the files and report to them to the Tracker as individual files. -
Hole-punching: The peer will do a UDP NAT Traversal to punch a hole. After that, it will tell the tracker its public IP and public port.
-
Send to Tracker the files you are willing to share, the chunk numbers for each of the files, as well as the checksum of each of these files. If it's a complete file, tell the Tracker how many chunks this file has. If it's an incomplete file, tell the Tracker which chunks of the original file you have.
- Peer supplies only 1
directory
for download and upload. Whatever you download from others must be shared with other peers. - Listening socket to accept incoming connections from other Peers. Used for download requests.
- Downloading of chunks is automatic i.e. User cannot, and does not, specify who to download from.
- After a download of a chunk is successful, report to
Tracker
that you own that chunk.
<file digest>.<chunk number>.chunk
- Every time a chunk is downloaded, check if the total number of chunks have been downloaded. If yes, combine the chunks into the full file
- Command to query server for list of files
- Command to query server for the list of Peers having a specific file (supply the file digest, rather than file name)
- Command to inform server of quitting (supplementary to our heartbeat)
- Will advertise to Peers the full list of files, together with the number of chunks of each file. Also contains the file digest of each of these files.
- Only tell the Peer the list of Peers who own the file after the Peer specifically requests for a particular file
- Before requesting the sender any chunks, the receiver will tell the tracker(signal server) to tell the sender that receiver wants a specific file size
- The receiver will then send a UDP packet with the sender IP as destination address and sender port as destination port. This is to handle Restric NAT, Restric Port NAT, since they have restricted on source IP and port. The receiver then listens through that UDP port
- The sender receives a request from the tracker(signal server). The sender creates the UDP packet and sends it to the receiver