An interactive file server that allows you to exchange files between multiple instances of the program. One combined mode of operation. At startup, the command line argument specifies the path to the directory for operation (maintenance). At the time of startup, the server recursively scans the specified directory and calculates hashes for all files. The program allows downloading these files to other instances connecting to it. In parallel, incoming connections are being received and commands are being entered from the console.
The screen interactively displays a list of downloaded and given files with progress in percentages and bytes, the command input area. Three commands are processed:
- Output of the "file name – size - hash" triplet for the relative path of the file from the working directory.
- Enter the "file name - size - hash" triplet for download.
- Completion of the program
When a download command is entered, other instances of the program are detected on the network using a UDP broadcast, and a response packet from them receives a port for TCP connection. After the connection is established, the file is requested via a triplet, and if it is detected, the download begins. The file server provides simultaneous downloading of different fragments of the same desired file from multiple sources