Jim's
Tutorials

Spring 2009
course
navigation

Peer protocol interaction

Becoming a Peer

  1. There is a folder of files, 00-MainDocuments, on Ryan's Laptop.
  2. A user on CS wants to become a peer of that folder, 00-MainDocuments.
  3. CS downloads this Peer client/server program.
  4. The CS User uses this program to send a BePeerRequest to Ryan's Laptop:
  5. BePeerRequest Line 1: BePeerRequest Line 2: 00-MainDocuments [file or folder name] Line 3: [EOL]
  6. Ryan's Laptop Peer program receives this request.
  7. Laptop Peer program checks for this folder's peerfile. (a file containing information about current peers and the folder's file structure.)
  8. Laptop Peer program sends FilesToGet message or asks another peer to handle the request and send CS Peer a FilesToGet message:
  9. FilesToGet - Note: The FilesToGet message cannot redirect them to another computer's IP address, the message must come from the computer hosting the files. Line 1: FilesToGet Line 2: 00-MainDocuments [file or folder name] Line 3: [Port # files are being served on] Line 4: HTTP [Protocol to request over] Line 5: File1 [First filename] Line 6...n: FileN [Last filename] Line n+1: [EOL]
  10. CS Peer receives the FilesToGet message and either automatically gets them through the appropriate protocol (in this case HTTP) or asks the user to get them manually.
  11. CS Peer then sends a FilesUpdated message to whatever computer sent them the FilesToGet message:
  12. FilesUpdated Line 1: FilesUpdated Line 2: 00-MainDocuments [file or folder name] Line 3: [Port # files are being served on] Line 4: HTTP [Protocol to request over] Line 5: File1 [First filename] Line 6...n: FileN [Last filename] Line n+1: [EOL]
  13. Laptop Peer (or the Peer handling the request) goes and downloads the files from CS Peer over the appropriate protocol (HTTP) and confirms that the files are correct.
  14. Laptop Peer (or the Peer handling the request) sends CS Peer TrustedPeerConfirm message:
  15. TrustedPeerConfirm Line 1: TrustedPeerConfirm Line 2: 00-MainDocuments [file or folder name] Line 3: [Port # files are being served on] Line 4: HTTP [Protocol to request over] Line 5: File1 [First filename] Line 6...n: FileN [Last filename] Line n+1: [EOL]
  16. Laptop Peer adds CS Peer to its Peerlist
  17. CS Peer adds Laptop Peer to its Peerlist

Updating Other Peers

When one Peer has updated a file, it needs to update all the Peers of that file. This Peer uses the last three steps from the Becoming A Peer process:
  1. The updated peer sends a FileToGet message including only the updated files
  2. The other Peers download the files and send a FilesUpdated message
  3. The initially-updated peer responds with TrustedPeerConfirm messages.
  4. Each Updated Peer in turn sends a FilesToGet message to all of its Peers, which respond with a FilesUpdated request when they have the updated file(s).
  5. Each Peer then downloads all of its peers' files, one-by-one, checking to make sure that they are authentic, and it sends a TrustedPeerConfirm to each Peer after confirming the files.