## Project 2: FTPClient #### Michelle Zinger ### This README covers Project 2. #### Description: Develop a client for the File Transfer Protocol (FTP) protocol. ## High-Level Overview The high-level approach that I used was to first initialize the first socket that we needed as the 'control' channel. I attempted to connect this socket and login to the server with my given username and password. I created a function to parse the incoming url and retrieve the necessary info to do so. Then, I ensured that I was getting the correct 'Welcome' message with the 2xx code. From there, I added support for sending 'TYPE', 'MODE', 'STRU', and 'QUIT' commands as was recommended by the project guidelines. I ensured that I received the correct responses from the server for each of these commands. Then, I went on to implement the next two commands 'MKD' and 'RMD.' Finally, I had to move onto implementing the support for the data channel. This meant implementing the 'PASV' command, and retrieving the necessary TCP/IP info for connection to the second socket as the 'data' channel. After this, I could implement 'LIST', 'STOR', 'RETR', and 'DELE' and cross-check that I received the correct responses for each of these commands. ## Challenges Some challenges I faced were in working with setting up the data channel. I was a bit unfamiliar about how the data channel would ooperate with the control channel, but after reading a bit more into the protocol, I began to understand at a deeper level. More specific challenges that I faced were in timeout errors. For example, I realized that if trying to list the contents in an empty directory, my client was continually waiting for a server response with '\r\n', however there is not always going to be such a response. So, I had to add a condition to my 'while' loop when receiving the server response that checked that the length of the data coming in was greater than 0. I also had a slight parsing issue which was messing up taking the paths when the path references a subdirectory because I was splitting the URL in the wrong way. ## Testing Code The main way in which I tested my code was through running command line instances of each operation multiple times and ensuring I received the correct response from the server each time. The responses were very indicative of whether I had implemented the operation in the correct way. I also tested making random txt files and moving them around from server to local and local to server (copying and moving, and ensuring they correctly get moved and/or deleted). Thus, testing each command separately and with different paths (as done in the example implementation), and cross-checking the responses after each command send, helped me test and ensure that my client was working properly.