Skip to content

A P2P file sharing system implemented using socket programming, multi-threading and SHA1 hashing. Users can share, download files from the group they belong to. Downloading is done in parallel with multiple pieces from multiple peers.

Notifications You must be signed in to change notification settings

akshayxml/Peer-to-Peer-Group-Based-File-Sharing-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Peer-to-Peer Group Based File Sharing System

Prerequisites

Software Requirement

  1. G++ compiler

    • To install G++ : sudo apt-get install g++
  2. OpenSSL library

    • To install OpenSSL library : sudo apt-get install openssl

Platform: Linux

Installation

1. cd client
2. make
3. cd ../tracker
5. make
6. cd ..

Usage

Tracker

  1. Run Tracker:
cd tracker
./tracker​ <TRACKER INFO FILE> <TRACKER NUMBER>
ex: ./tracker tracker_info.txt 1

<TRACKER INFO FILE> contains the IP, Port details of all the trackers.

Ex:
127.0.0.1
5000
127.0.0.1
6000
  1. Close Tracker:
quit

Client:

  1. Run Client:
cd client
./client​ <IP>:<PORT> <TRACKER INFO FILE>
ex: ./client 127.0.0.1:18000 tracker_info.txt
  1. Create user account:
create_user​ <user_id> <password>
  1. Login:
login​ <user_id> <password>
  1. Create Group:
create_group​ <group_id>
  1. Join Group:
join_group​ <group_id>
  1. Leave Group:
leave_group​ <group_id>
  1. List pending requests:
list_requests ​<group_id>
  1. Accept Group Joining Request:
accept_request​ <group_id> <user_id>
  1. List All Group In Network:
list_groups
  1. List All sharable Files In Group:
list_files​ <group_id>
  1. Upload File:
​upload_file​ <file_path> <group_id​>
  1. Download File:​
download_file​ <group_id> <file_name> <destination_path>
  1. Logout:​
logout
  1. Show_downloads: ​
show_downloads
  1. Stop sharing: ​
stop_share ​<group_id> <file_name>

Working

  1. User should create an account and register with tracker.
  2. Login using the user credentials.
  3. Tracker maintains information of clients with their files(shared by client) to assist the clients for the communication between peers.
  4. User can create Group and hence will become admin of that group.
  5. User can fetch list of all Groups in server.
  6. User can join/leave group.
  7. Group admin can accept group join requests.
  8. Share file across group: Shares the filename and SHA1 hash of the complete file as well as piecewise SHA1 with the tracker.
  9. Fetch list of all sharable files in a Group.
  10. Download:
    1. Retrieve peer information from tracker for the file.
    2. Download file from multiple peers (different pieces of file from different peers - ​piece selection algorithm​) simultaneously and all the files which client downloads will be shareable to other users in the same group. File integrity is ensured using SHA1 comparison.
  11. Piece selection algorithm used: Selects random piece and then downloads it from a random peer having that piece.
  12. Show downloads.
  13. Stop sharing file.
  14. Logout - stops sharing all files.
  15. Whenever client logins, all previously shared files before logout should automatically be on sharing mode.

Assumptions

  1. Only one tracker is implemented and that tracker should always be online.
  2. The peer can login from different IP addresses, but the details of his downloads/uploads will not be persistent across sessions.
  3. SHA1 integrity checking doesn't work correctly for binary files, even though in most likelihood the file would have downloaded correctly.
  4. File paths should be absolute.

About

A P2P file sharing system implemented using socket programming, multi-threading and SHA1 hashing. Users can share, download files from the group they belong to. Downloading is done in parallel with multiple pieces from multiple peers.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published