先讓我們來看看一個典型的FTP任務是怎樣完成的吧!
--------------------------------------------------------------------------------
$ ftp ftp.server.com
Connected to ftp.server.com
220 server.com FTP server ready.
Name (server:john): john
331 PassWord required for john.
Password:
230 User john logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
drwxr-xr-x 5 john users 3072 Nov 2 11:03 .
drwxr-xr-x 88 root root 2048 Nov 1 23:26 ..
drwxr--r-- 2 john users 1024 Oct 5 13:26 bin
drwx--x--x 8 john users 1024 Nov 2 10:59 public_html
drwxr--r-- 4 john users 1024 Nov 2 11:26 tmp
-rw-r--r-- 1 john users 2941465 Oct 9 17:21 data.zip
226 Transfer complete.
ftp> bin
200 Type set to I.
ftp> get data.zip
local: data.zip remote: data.zip
200 PORT command successful.
150 Opening BINARY mode data connection for data.zip(2941465 bytes).
226 Transfer complete.
ftp> bye
221 Goodbye.
--------------------------------------------------------------------------------
你可以看到,進程明顯被分為幾段:聯結(與FTP伺服器建立聯結)、驗證(確定使用者是否有權力進入系統)、傳輸(這裡包括列目錄,上傳或下載檔案)、取消聯結。