CSS 432
Program 5: FTP Client

Professor Dimpsey


1. Purpose

This is an individual project to impelment an ftp client program based on the RFC protocol.

2. File Transfer Protocol

The file transfer protocol is defined in RFC 959. Visit http://www.ietf.org, read this document, and understand the FTP functionalities in terms of USER, PASS, SYST, PASV, LIST, RETR, STOR, and QUIT.

3. Statement of Work

3.1 Implementation

Design and code a limited ftp client program that is based on RFC 959. The program will be limited to the commands below.

The program should be invoked with ftp [hostname]. It connects a session to the remote hostname server using the default port 21 and transfers files in passive mode. If no argument is given, the client program does not establish any connection until it receives an open command (See below).

ftp client interface the corresponding RFC959 commands behavior
open ip port N/A Establish a TCP connection to ip on port.
name: account USER account Send a user identification to the server.
password: user_password PASS user_password
SYST
Send the user password to the server.
cd subdir CWD subdir change the server's current working directory to subdir
ls PASV
LIST
Ask the server to send back its current directory contents through the data connection.
get file PASV
RETR file
Get a file from the current remote directory.
put file PASV
STOR file
Store a file into the current remote directory.
close QUIT Close the connection but not quit ftp.
quit QUIT (if not closed) Close the connection and quit ftp.
Note that PASV requests the server to send back its IP and port on which it listens to a data TCP connection from the client.

3.2 Verification

To test your client program, you should conduct the following verification. Note that any ftp server should work but an account has been setup on ftp.tripod.com to aid in tesing.

Run your client program on a UW1-320 linux machine and connect to the ftp.tripod.com server. Your client program must respond to a user authentication using the css432 account, and perform cd, ls, get, put, close and quit commands. The password for css432 has been provided in class.

[uw1-320-20]$ ./ftp ftp.tripod.com
220 Welcome to Tripod FTP.
Name (ftp.tripod.com:dimpsey): css432
331 Username set to css432. Now enter your password.
Password: *********
230- ============================================================
230-                      IMPORTANT NOTICE
230- ============================================================
230- 
230- Powerful building tools. Traffic-generating, money-making
230- programs. It's all waiting for you at the new Tripod.
230- 
230-   httpd://www.tripod.com/
230- 
230- ============================================================
230- 
230- Tripod offers a cgi-bin to all members! For more 
230- information, visit our CGI tutorial.
230- 
230-   httpd://www.tripod.lycos.com/build/module_library/tutorial/
230- 
230- ============================================================
230- 
230- Got a great idea for a website?  Then don't 
230- wait, get your own web address today! 
230- 
230-   httpd://tripod.domains.lycos.com/
230- 
230- ============================================================
230- 
230- Visit Tripod's Script Library, with free, easy-to-use,
230- customizable CGI and JavaScripts available to all members.
230- 
230-   httpd://build.tripod.com/tools/script_library
230-
230- ============================================================
230- 
230- We heard you loud and clear! You love your site, but
230- you don't like the ads.  Remove those pesky popups 
230- forever with Tripod Plus!
230- 
230-   httpd://www.tripod.lycos.com/host/plus.html
230- 
230- ============================================================
230 User 'css432' logged on.
215 UNIX Type: L8
ftp> ls
227 Entering Passive Mode (209,202,240,80,206,212)
150 Opening ASCII mode data connection for LIST.
drwxr-xr-x   1 css432   Tripod          0 Sep 15 21:22 cgi-bin
-rw-r--r--   1 css432   Tripod      26169 Sep 16 18:28 ttcp.c
-rw-r--r--   1 css432   Tripod       8236 Sep 15 21:22 index.htm
drwxr-xr-x   1 css432   Tripod          0 Sep 15 21:22 _private
drwxr-xr-x   1 css432   Tripod          0 Sep 16 18:32 project
226 Transfer complete.
ftp> get ttcp.c
227 Entering Passive Mode (209,202,240,80,206,221)
200 Type set to 'I' (IMAGE aka BINARY).
150 Opening BINARY mode data connection for 'ttcp.c'.
226 Transfer complete.  (26169 bytes sent.)
ftp> cd project
250 Directory set to '/project'.
ftp> ls
227 Entering Passive Mode (209,202,240,80,206,229)
150 Opening ASCII mode data connection for LIST.
226 Transfer complete.
ftp> put
(local-file) data
(remote-file) MFukuda.txt
227 Entering Passive Mode (209,202,240,80,206,248)
200 Type set to 'I' (IMAGE aka BINARY).
150 Opening BINARY mode data connection for 'MFukuda.txt'.
226 Transfer complete.  (26169 bytes sent.)
ftp> ls
227 Entering Passive Mode (209,202,240,80,206,252)
150 Opening ASCII mode data connection for LIST.
-rw-r--r--   1 css432   Tripod      26169 Sep 16 18:33 MFukuda.txt
226 Transfer complete.
ftp> close
221 Goodbye...
ftp> quit
[uw1-320-20]$
Do not overwrite any files in css432@ftp.tripod.com's home directory. Put any of your files under only the project directory in order to test your ftp client's put command. Your ftp client program may indicate a password on your computer display, although the above example hid the css432's password with *********.

3.3 telnet and the unix ftp

Typing telnet ftp.tripod.com 21 and interacting with the ftp server will help you understand what the server returns to you in response to each command you have typed. Running the unix ftp would help you justify your implementation in terms of execution performance and functionality.

4. What to Turn in

Each student must submit the following in a .zip file to Canvas.
  1. A .pdf or .docx file with a clear design explanation.
  2. All code required to build the ftp client along with a build script.
  3. The ftp client executable.

Your final project will be graded with the following criteria:
Criteria Weight
Design of your implementation including explanations and illustrations 10pts (25%)
(1) client's interface in terms of OPEN, PASS/SYST, and QUIT
(2) client's get function in terms of PAV, RETR, and local file options( O_CREAT | O_WRONLY and S_IRUSR | S_IWUSR |S_IRGRP | S_IROTH)
(3) client's cd function (i.e., CWD)
(4) client's ls function in terms of PASV, LIST, and file output to stdout
(5) client's put function in terms of PASV, STOR, and local file option (O_RDONLY)
Client functionality as well as code that adheres good modularization, coding style, and an appropriate amount of comments. 30pts (75%)
(1) the correctness of client's interface (USER/PASS/SYST/QUIT) including authentication 5pts
(2) the correctness of client's get (PASV/RETR) function 5pts
(3) the correctness of client's cd (CWD )function 5pt
(4) the correctness of client's ls (PASV/LIST) function 5pts
(5) the correctness of client's put (PASV/STOR) function 5pts
(6) coding style 5pts
Total 40pts (100%)

5. FAQ

This FAQ page may answer your quetions. Click here