This repository contains a simplified BitTorrent-style peer-to-peer file sharing system for the CNT4007 course.
Each peer participates in a distributed swarm, exchanging file pieces until all peers complete the download.
Before running the project, ensure you have:
- Java 21 installed and available on your PATH
- Maven installed (
mvn -vshould work) - A Unix-like shell environment (macOS/Linux or WSL)
-
Clone the repository
git clone [<repo-url>](https://github.com/KalebE36/matey) cd matey -
Build the project
make install
This performs a clean Maven build and prepares the project for execution.
Note: We use the
algo.pdfas the test file. This is approximately 5Mb and we transfer at a rate of 256Kb per piece. You can configure all of these, but if you change the file make sure to put it in root and change thecfg/Common.cfgto match the new file.
-
Make the script executable:
chmod +x ./launch_peers.sh -
Start the full swarm:
./launch_peers.sh
This automatically launches all peer terminals and starts the system.
Open multiple terminal windows and run:
make run-peer-0
make run-peer-1
...
make run-peer-5
Important: Start the lower-numbered peers first.
Peer 1001 is currently the seed peer, so ensure it starts before the others.
-
Logs generated via
launch_peers.share stored under:logs/ -
Each peer stores its downloaded file under:
peer_[peerId]/
Example:
peer_1002/
peer_1003/
...
- Ensure all peers use the same configuration files included in the root directory.
- If needed, delete peer directories and logs to reset the environment before re-running.
Happy testing!
This implementation supports the core protocol mechanics required for CNT4007’s networking project.