Download Manager (Client) is semester project for the school subject Principles of Operating Systems. The aim of the work was to implement low-level application in C/C++ language with emphasis on multithreading and network protocols implementation.
The application is controlled via the command line interface (terminal).
The commands are inspired by classic Unix-like commands such as ls, pwd, mkdir, touch, cat etc.
(example of application interface)
libCURL library is used for network communication, which is an "unwritten standard" in network communication on client side of the C language application, that supports http, https, ftp, sftp and many other protocols.
Arguments type:
- [required]
- |optional|
Lists all files and folders in the directory specified as an argument. If no path is specified, the current directory is used.
Lists the path to the current folder.
Creates an empty file.
Deletes the file whose path is specified by the argument.
Creates an empty directory.
Recursively deletes the directory whose path is specified by the argument. If no path is specified, it deletes the current directory.
Move in the directory structure to the address specified by the argument.
Lists the contents of the file.
Copies the file specified by the argument to the directory specified by the next argument.
Recursively copies the directory with all its contents to the location specified by the argument
Moves the file specified by the argument to the directory specified by the next argument.
Displays the current local time.
Starts the download via http the protocol. The file specified by the argument as a URL to a file that is also specified by the argument. Communication works on port no. 80.
Starts an encrypted download via the https protocol. The file specified by the argument as a URL to a file that is also specified by the argument. Communication works on port no. 443.
Starts the download via the ftp protocol. The file specified by the argument as a URL to a file that is also specified by the argument. Communication works on port no. 20.
Starts an http download on a new thread. (arguments same as http)
Starts an http download on a new thread. (arguments same as https)
Starts an ftp download on a new thread. (arguments same as ftp)
Sets the start of http download to the specified date and time in the format DD.MM.YYYY hh:mm:ss.
Sets the start of https download to the specified date and time in the format DD.MM.YYYY hh:mm:ss.
Sets the start of ftp download to the specified date and time in the format DD.MM.YYYY hh:mm:ss.
Lists the history of downloaded files.
Pauses the download. If the argument specifies the download address of the command (we can see it using the url_list command), only one download is paused. If the command is used without an argument, all downloads are paused.
Resumes the paused download. If the argument specifies the download address of the command (we can see it using the url_list command), only one download will start. If the command is used without an argument, all downloads will start.
Stops download. If the argument specifies the download address of the command (we can see it using the url_list command), only one download will stop. If the command is used without an argument, all downloads will stop.
Displays the current downloads, along with the address of the download command (key in std::map).
Thread class.
This class wraps the standard std::thread and adds functionality for suspending and checking thread status. For proper operation of state changes, a mutex is used, with which two condition_variable work.
This class is used mainly for asynchronous downloads, where we do not want the execution of the download to block the main thread for entering commands.
Timer class.
The interval between the execution of the main algorithm is defined in milliseconds. If we use the class in "date" mode, the interval between the scheduled time and the current time is calculated. (timeSinceEpoch), and the main algorithm is executed once. It is also possible to specify the “pauseFunction” and “stopFunction” functions, which can implement the algorithm, for conditional pause / termination of the algorithm. These functions must have a bool return value.