
356
Using an FTP Command Line Client
Assuming that you typed the site name correctly, the FTP command connects
to the site, displays the banner message, and prompts you to log on:
Connected to ftp.lowewriter.com.
220-Microsoft FTP Service
220 We have 999 spooks here, but there’s always room for one
more! To volunteer, log in as Anonymous.
User (ftp.lowewriter.com:(none)):
To log on anonymously, type Anonymous and then press Enter. The server
responds by telling you that Anonymous access is allowed and asks for your
e-mail address as a password:
331 Anonymous access allowed, send identity (e-mail name) as
password.
Password:
Type your e-mail address as the password and then press Enter. The
Welcome message appears, followed by the ftp> prompt:
230-Welcome to my FTP site! For spooky Halloween pictures,
check out the Pics folder.
230 Anonymous user logged in.
ftp>
Whenever you see the ftp> prompt, the FTP command is waiting for you to
enter a subcommand. Start by entering dir to see a directory listing:
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
06-30-07 08:05PM <DIR> pics
06-30-07 07:55PM 2365 readme.txt
06-30-07 07:55PM <DIR> sounds
06-30-07 07:56PM <DIR> videos
226 Transfer complete.
ftp: 190 bytes received in 0.00Seconds 190000.00Kbytes/sec.
ftp>
As you can see, the response from the dir command isn’t quite as clean as
the display from an MS-DOS command. Still, you can pick out that the directory
includes three subdirectories, named pics, sounds, and videos, and a
single file, named readme.txt. The size of the file is 2,365 bytes.
Here’s a good question: If you enter a dir command, why does the response
read 200 PORT command successful? The answer has to do with how
the FTP protocol works. When you enter a dir command, the FTP client
forwards a PORT command to the server that opens a data transfer port that
is then used to return the resulting directory listing. The server replies that
the PORT command has successfully opened a data transfer port. Then, it
sends back the directory listing. Finally, it sends two more lines: one to
indicate that the transfer is complete (that is, that the dir output has been
successfully sent), and the other to summarize the number of bytes of data
that were sent and the data transfer rate.
34_625873-bk04ch05.indd 35634_625873-bk04ch05.indd 356 9/21/10 10:31 PM9/21/10 10:31 PM