Upload
zarek
View
20
Download
2
Embed Size (px)
DESCRIPTION
FTP. Introduction. File Transfer Protocol RFC 959 Transfer file to / from remote host Client / Server architecture Separate control, data connection FTP server control connection : port 21. Model for FTP (1/2). User Interface. User. FTP Command. Server PI. User PI. FTP Replies. - PowerPoint PPT Presentation
Citation preview
FTP
Introduction
File Transfer Protocol RFC 959 Transfer file to / from remote host Client / Server architecture Separate control, data connection FTP server control connection : port
21
Model for FTP (1/2)
ServerPI
ServerDTP
UserDTP
UserPI
UserInterface
FTP Command
FTP Replies
DataConnection
Server-FTP USER-FTP
FileSystem
FileSystem
User
Model for FTP (2/2)
PI : The protocol interpreter DTP : The data transfer process
establishes and manages the data connection
The Data connection may be used in either direction
The data connection need not exist all of the time
FTP Command (1/3) USER
Syntax : USER username Used to send the user identification to the server Response : 331 (username okay, need password)
PASS Syntax : PASS password Used to send password to the server Response : 230 (user logged in)
PWD Syntax : PWD Used to get the current working directory Response : 257 (current directory)
FTP Command (2/3) PASV
Syntax : PASV Used to request the server to listen on a data port Response : 227 (entering passive mode) The response includes the host and port address this
server is listening on Ex : 163.112.28.104.19.196
IP : 163.112.28.104 Port : 19x256+196 = 5060
LIST Syntax : LIST Used to ask the server to send back a list of all the
files in the current remote directory
FTP Command (3/3) CWD
Syntax : CWD pathname Used to change working directory Response : 250 (Request file action okay)
TYPE Syntax : TYPE type Response : 200
RETR Syntax : RETR filename Used to get a file from the current directory of the re
mote host
NOTE
We must append “\r\n” to the end of FTP command
LoginClientClient
Control Port
ControlPort(21)
ServerServer
TCP connection
220 ready
USER username
331 password require
PASS password
230 user username logged in
Print Working DirectoryClientClient
Control Port
ControlPort(21)
ServerServer
PWD
257 “/” is current direction
List Files in Current DirectoryClientClient
Control Port
ControlPort(21)
ServerServer
PASV
227 Entering Passive Mode(163.112.28.104.19.19619.196)
LIST
DataPort
DataPort
TCP connectionPort:5060150 Data Connection
FTP-DA
Close TCP connection
226 Transfer ok
Change Working DirectoryClientClient
Control Port
ControlPort(21)
ServerServer
CWD pathname
250 CWD command successful
Download File (1/2)ClientClient
Control Port
ControlPort(21)
ServerServer
DataPort
DataPort
Type I
200 Type set to I
PASV
227 Entering Passive Mode
RETR filename
TCP connection
150 Data Connection
FTP-DA ( 傳檔案 )
Download File (2/2)ClientClient
Control Port
ControlPort(21)
ServerServer
DataPort
DataPort
Close TCP connection
226 file send ok
Resource
RFC 959, http://www.ietf.org Ethereal, http://www.ethereal.com
評分標準 基本功能 ( 共 85%)
顯示所有傳送出和接收到的訊息 (5%) 使用帳號和密碼登入 FTP Server (15%) 顯示目前所在工作目錄 (10%) 列出目前工作目錄內容 (15%) 切換工作目錄 (10%) 下載 FTP Server 端的檔案至本機端磁碟中 (25%) 結束與 FTP Server 的連線 (5%)
書面報告 ( 共 10%) 程式架構與寫法介紹 (5%) 程式功能與操作方法 (5%)
程式註解 (5%) 其他功能 (Bonus)
上傳檔案至 FTP Server (10%) 可同時下載多個檔案 (10%)
繳交日期 94 年 5 月 9 日 24:00 前 於截止時間前將 Source Code 寄至
[email protected] Demo 地點 : R219 Demo 時段
5/10 ( 三 ) 5/11 ( 四 )
請於 Demo 前一週至 R442 門口填表預約時段
注意事項 可以使用任何程式語言 不可使用和 FTP 相關的 API Demo 時當場以截止繳交日期前寄出的 source code 編譯執行
檔 執行環境以 R219 電腦中可提供的為主 , 如使用特殊的 Compil
er, 請自行準備執行環境 作業驗收標準以可在 R219 之電腦執行為準 , 若 Demo 時程式
無法於 R219 之電腦執行 , 則視同作業未完成 ( 可自備執行環境 , 工作站上亦可 )
作業驗收時 , 只要能通過指定的 FTP Server 之測試即可 作業請勿抄襲 Demo 時請攜帶書面報告紙本 , 並於封面註明姓名與學號