Introduction
There are 2 goals for this project. The first goal is to develop a download application that can download a file from a given URL. The second goal is to configure a network on the NetLab room and test the download application on the network.
Part 1: Development of a Download Application
The download application is developed in C, and it implements the FTP protocol (RFC959).It is able to download a single file from a given URL in the form of ftp://[user[:password]@]host[:port]/path.
It does so by following these steps:
- Parse the URL to extract the host, port, path, username and password.
- Make a DNS query to resolve the host name to an IP address.
- Establish a TCP connection to the FTP server using
sockets. - Authenticate with the server using the username and password.
- Activate passive mode.
- Open a new socket for data transfer.
- Send the
RETRcommand to the server via the first connection to request the file. - Receive the file data from the server via the second connection.
- Write the file data to a local file.
- Close the connections.