Download presentation
Presentation is loading. Please wait.
1
FTP
2
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
3
Model for FTP (1/2) User Interface User FTP Command Server PI User PI
FTP Replies Data File System Server DTP User DTP File System Connection Server-FTP USER-FTP
4
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
5
FTP Command (1/3) USER PASS PWD 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)
6
FTP Command (2/3) PASV LIST 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 : IP : Port : 19x = 5060 LIST Syntax : LIST Used to ask the server to send back a list of all the files in the current remote directory
7
FTP Command (3/3) CWD TYPE RETR 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 remote host
8
NOTE We must append “\r\n” to the end of FTP command
9
Login Client Server Control Port Control Port(21) TCP connection
220 ready USER username 331 password require PASS password 230 user username logged in
10
Print Working Directory
Client Server Control Port Control Port(21) PWD 257 “/” is current direction
11
List Files in Current Directory
Client Server Data Port Control Port Control Port(21) Data Port PASV 227 Entering Passive Mode ( ) LIST TCP connection Port: 5060 150 Data Connection FTP-DA Close TCP connection 226 Transfer ok
12
Change Working Directory
Client Server Control Port Control Port(21) CWD pathname 250 CWD command successful
13
Download File (1/2) Client Server Data Port Control Port Control
Type I 200 Type set to I PASV 227 Entering Passive Mode RETR filename TCP connection 150 Data Connection FTP-DA (傳檔案)
14
Download File (2/2) Client Server Data Port Control Port Control
Close TCP connection 226 file send ok
15
Resource RFC 959, http://www.ietf.org
Ethereal,
16
評分標準 基本功能 (共85%) 書面報告 (共10%) 程式註解 (5%) 其他功能 (Bonus)
顯示所有傳送出和接收到的訊息 (5%) 使用帳號和密碼登入FTP Server (15%) 顯示目前所在工作目錄 (10%) 列出目前工作目錄內容 (15%) 切換工作目錄 (10%) 下載FTP Server端的檔案至本機端磁碟中 (25%) 結束與FTP Server的連線 (5%) 書面報告 (共10%) 程式架構與寫法介紹 (5%) 程式功能與操作方法 (5%) 程式註解 (5%) 其他功能 (Bonus) 上傳檔案至FTP Server (10%) 可同時下載多個檔案 (10%)
17
繳交日期 94年5月9日 24:00前 於截止時間前將Source Code寄至 network2006@csie.ntu.edu.tw
Demo地點 : R219 Demo時段 5/10 (三) 5/11 (四) 請於Demo前一週至R442門口填表預約時段
18
注意事項 可以使用任何程式語言 不可使用和FTP相關的API Demo時當場以截止繳交日期前寄出的source code編譯執行檔
執行環境以R219電腦中可提供的為主,如使用特殊的Compiler,請自行準備執行環境 作業驗收標準以可在 R219 之電腦執行為準,若Demo時程式無法於 R219 之電腦執行,則視同作業未完成 (可自備執行環境,工作站上亦可) 作業驗收時,只要能通過指定的FTP Server之測試即可 作業請勿抄襲 Demo 時請攜帶書面報告紙本,並於封面註明姓名與學號
Similar presentations