This project implements a reliable file transfer protocol using UDP with features such as acknowledgments, retransmissions, timeouts, and packet reordering. It consists of a sender, receiver, and a network simulator that introduces loss, corruption, and reordering for testing.
- Python 3.x
sender.py- Sends a file to the receiver in chunks, implementing reliability mechanisms.receiver.py- Receives packets, handles reordering, and writes the received file to disk.network_simulator.py- Simulates packet loss, corruption, and reordering.utils.py- Contains helper functions and constants for packet handling.launcher.py- Automates the process of starting all components.
To automatically start all components, run:
python launcher.pyFollow the prompts to specify the input file and output file.
python network_simulator.pypython receiver.py output_fileReplace output_file with the name of the file to be saved.
python sender.py input_fileReplace input_file with the file you want to send.
python launcher.py- Input file:
example.txt - Output file:
received_example.txt
python network_simulator.py &
python receiver.py received_image.jpg &
python sender.py image.jpgThis will transfer image.jpg to received_image.jpg via the simulated network.
- The network simulator introduces packet loss, corruption, and reordering for testing reliability.
- Ensure that all components are running before starting the sender.
- The receiver will reconstruct the file and write it to disk after receiving all packets.