Skip to content

This repository is created as a part of the P2p project for Computer Networks (CNT5106C) at the University of Florida for the Master's in Computer Science program. A simplified P2p network where any number of peers can share any type of file among themselves. Implemented in Java.

Notifications You must be signed in to change notification settings

shantanu-ai/P2P-File-sharing

Repository files navigation

P2P File Sharing

  1. no always-on server
  2. arbitrary end systems directly communicate
  3. peers request service from other peers, provide service in return to other peers
    • self scalability – new peers bring new service capacity, as well as new service demands
  4. peers are intermittently connected and change IP addresses
    • complex management

Programming Environment

Java

Requirement

Requirement is specified in the Project2.pdf and Project2.pptx file.

Compile

File owner
cd Peer1_Owner
javac FileOwner.java

Peer2
cd Peer2
javac Peer.java

Peer3
cd Peer3
javac Peer2.java

Peer4
cd Peer4
javac Peer.java

Peer5
cd Peer5
javac Peer5.java

Peer6
cd Peer6
javac Peer6.java

Demo video

Click on the following link to get a live demo of the project.

Alt text

How to run

  1. Start the file owner process, giving a listening port.
  2. Start five peer processes as: file owner, peer itself, download neighbor(another peer’s port)
  3. Each peer connects to the server’s listening port. The latter creates a new thread to upload one or several file chunks to the peer, while its main thread goes back to listening for new peers.
  4. After receiving chunk(s) from the file owner, the peer stores them as separate file(s) and creates a summary file, listing the IDs of the chunks it has.
  5. The peer then proceeds with two new threads, with one thread listening to its upload neighbor to which it will upload file chunks, and the other thread connecting to its download neighbor.
  6. The peer requests for the chunk ID list from the download neighbor, compares with its own to find the missing ones, and randomly requests a missing chunk from the neighbor. In the meantime, it sends its own chunk ID list to its upload neighbor, and upon request uploads chunks to the neighbor.
  7. After a peer has all file chunks, it combines them for a single file.
  8. A peer MUST output its activity to its console whenever it receives a chunk, sends a chunk, receives a chunk ID list, sends out a chunk ID list, requests for chunks, or receives such a request.

Post Completion:

After completion the file will be downloaded to each of the peer. Plus inside each Peer on PeerDir folder will be created where all the file chunks and a summary file which contains the chunk ids that the peer got from the owner will be present. A detailed demo video can be found as demo.mp4 file.

About

This repository is created as a part of the P2p project for Computer Networks (CNT5106C) at the University of Florida for the Master's in Computer Science program. A simplified P2p network where any number of peers can share any type of file among themselves. Implemented in Java.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages