CSS 432
Program 5: FTP Client
Professor Dimpsey
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. |
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 *********.
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%) |