Leo Graham Justin Ming Julia Bush Raymon Martinez
This project implements a BitTorrent-style peer-to-peer file sharing system for CNT4007.
peerProcess.py- launcher for a peer processpeer.py- main peer logicconn.py- TCP connection and message framing helpersConfigs/Common.cfg- shared file-transfer settingsConfigs/PeerInfo.cfg- peer list, ports, and seed status
When you run:
python peerProcess.py <peerID>the program automatically:
- reads
Configs/Common.cfg - reads
Configs/PeerInfo.cfg - creates or uses
peer_<peerID>in the project root - writes logs to
log_peer_<peerID>.login the project root
The current config is a 3-peer localhost setup:
1001 localhost 7101 1
1002 localhost 7102 0
1003 localhost 7103 0That means:
- peer
1001starts with the full file - peers
1002and1003start empty - all 3 peers can be run on one machine in separate terminals
Make sure these folders exist:
peer_1001peer_1002peer_1003
Make sure the seed file exists here before starting:
peer_1001/tree.jpgThat filename should match FileName in Configs/Common.cfg.
Do not place the file in peer_1002 or peer_1003 before the run.
Open 3 terminals in the project root and run:
python peerProcess.py 1001python peerProcess.py 1002python peerProcess.py 1003When the run finishes:
- the file should appear in
peer_1002 - the file should appear in
peer_1003 log_peer_1001.log,log_peer_1002.log, andlog_peer_1003.logshould exist
To run on multiple machines:
- Put the same project code on each machine.
- Keep the same
Configs/Common.cfgon each machine. - Update
Configs/PeerInfo.cfgso each peer uses a real reachable hostname or IP instead oflocalhost. - Put the seed file only in the folder for peers marked with
1. - Run one peer process per listed peer.
Example 3-machine config:
1001 192.168.1.10 7101 1
1002 192.168.1.11 7102 0
1003 192.168.1.12 7103 0Then run:
- machine 1:
python peerProcess.py 1001 - machine 2:
python peerProcess.py 1002 - machine 3:
python peerProcess.py 1003
Before running, you can verify the code compiles:
python -m py_compile conn.py peer.py peerProcess.py