You can edit the file config/peers.ini
to change the IP addresses and port numbers of the peers.
The discoverable port number is fixed to 9000 and cannot be changed.
The default config file is:
[tracker]
ip_address = 127.0.0.1
port_number = 8000
[alice]
ip_address = 127.0.0.1
port_number = 8001
[bob]
ip_address = 127.0.0.1
port_number = 8002
head -c [bytes_count] < /dev/urandom > files/[filename]
First create the directory files/
and add a file or create a new file with random bytes.
Then, run:
python3 src/create_chunks.py [filename]
The first third of the chunks are owned only by Alice. The second third are owmed by Alice and Bob. And the last third are owned only by Bob.
Launch Alice and Bob in two terminals:
python3 src/alice.py
python3 src/bob.py
Launch Charlie (you) in a third terminal:
python3 src/charlie.py 1
where 1
is the step number.
Launch Alice and Bob in two terminals:
python3 src/alice.py
python3 src/bob.py
Launch the tracker in a terminal:
python3 src/tracker.py
Launch Charlie (you) in a third terminal:
python3 src/charlie.py 2
where 2
is the step number.
Launch Alice and Bob in two terminals:
python3 src/alice.py
python3 src/bob.py
Launch the tracker in a terminal:
python3 src/tracker.py
Launch Charlie (you) in a third terminal:
python3 src/charlie.py 3
where 3
is the step number.
In order to recover the file from the downloaded chunks, run:
python3 src/merge_chunks.py
In order to check if the file is exactly the same, run:
python3 src/check_file.py