1 / 14

Tips on FTP Implementation

Tips on FTP Implementation. FTP Model. User Commands. User Interface. User. FTP Commands. Server PI. User PI. FTP Replies. Port L. File System. Server DTP. User DTP. File System. Data Connection. Port L-1. FTP Server. FTP Client. PI: Protocol Interpreter

wood
Télécharger la présentation

Tips on FTP Implementation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Tips on FTP Implementation

  2. FTP Model User Commands User Interface User FTP Commands Server PI User PI FTP Replies Port L File System Server DTP User DTP File System Data Connection Port L-1 FTP Server FTP Client PI: Protocol Interpreter DTP: Data Transfer Process Jin Pyo Hong, HUFS

  3. Commands: Minimum Implementation Jin Pyo Hong, HUFS

  4. FTP Replies Jin Pyo Hong, HUFS

  5. 125 Data connection already open; transfer starting. 150 File status okay; about to open data connection. 200 Command okay. 212 Directory status. 213 File status. 220 Service ready for new user. 221 Service closing control connection. 225 Data connection open; no transfer in progress. 226 Closing data connection. 227 Entering Passive Mode (203,253,69,113,201,131) 230 User logged in, proceed. 250 Requested file action okay, completed. 331 User name okay, need password. 350 Requested file action pending further information. 421 Service not available, closing control connection. 425 Can't open data connection. 426 Connection closed; transfer aborted. 450 Requested file action not taken. File unavailable (e.g., file busy). 500 Syntax error, command unrecognized. 502 Command not implemented. 530 Not logged in. 550 Requested action not taken. File unavailable (e.g., file not found, no access). FTP Response Codes Jin Pyo Hong, HUFS

  6. Open and Closing FTP Sessions User Interface User PI Server PI open <host> or from argv • 설계: State transition diagram • - Event: User command, Reply msg • Action: send FTP command … • * reply msg에 대한 state transition도 • 포함해야 Establish Control Connection 220 Service ready <user name> USER <user name> <password> 331 Need passwd State transition table을 만든다면, if-then-else를 쓰지 않고, table-driven programming할 수 있지 않을까? PASS <password> 230 User logged in Data Transfer Session close bye, quit QUIT 221 Service closing Jin Pyo Hong, HUFS

  7. Data Transfer: get, out, ls- active mode (passive mode off) Server PI Server DTP User Interface User DTP User PI User logged in How to know the listening socket address? - IPaddr: control connection socket에서 /* getsockname(controlfd, …); */ - port: 0 - bind(listenfd, …); /* kernel이 사용하지 않는 port를 선택 */ - listen(listenfd, …); - getsockname(listenfd, …); - send PORT command - datafd = accept(listenfd, … ); get/put/ls <file> PORT h1,h2,h3,h4,p1,p2 200 Command Successful RETR/STOR/LIST <file> Establish data connection 150 Opening data connection Data Transfer Close connection 226 Transfer Complete Jin Pyo Hong, HUFS

  8. Data Transfer: get, put, ls- passive mode on Server PI Server DTP User Interface User DTP User PI IP addr, port of server DTP (server’s listening socket addr) get/put/ls <file> PASV 227 Entering Passive Mode (203,253,69,113,201,131) RETR/STOR/LIST <file> Establish data connection 150 Opening data connection Data Transfer Close connection 226 Transfer Complete Jin Pyo Hong, HUFS

  9. FTP command and Response Jin Pyo Hong, HUFS

  10. More Specific Diagram Wait for S reply Wait for I reply Wait for P reply Wait for S reply , 3 4, 5 F Login sequence Jin Pyo Hong, HUFS

  11. State Transition Diagram • open, user Wait for I reply Wait for S reply 3 PASS 2 NULL 2 NULL open Open control Connection user USER Wait for User Cmd Jin Pyo Hong, HUFS

  12. State Transition Diagram • pwd, cd, ascii, binary, system, close 1, 3 Error 2 Success 4, 5 Failure pwd, cd, ascii, binary, system, close PWD, CWD, TYPE A, TYPE I, SYST, QUIT Wait For S reply Wait for User Cmd Jin Pyo Hong, HUFS

  13. State Transition Diagram • ls, dir, nlist, get, put Wait for User Cmd Wait for S reply - 1 Wait for S reply - 2 ls, dir, nlist Type A 2 PASV/ PORT get, put PASV / PORT 2 Connect/Listen (LIST/NLIST/RETR/STOR) 1 Pre Reply 2 Close Data Connection 2 Close Data Connection Wait for P reply Data Transfer Jin Pyo Hong, HUFS

  14. Event State Table

More Related