FTP(File Transfer Protocol)
协议文档: RFC 959
1.1 FTP 协议介绍
FTP 协议基于 TCP/IP 协议实现, 处于应用层.
FTP 协议为 C/S 架构, 每一次 FTP 连接, 命令和数据分别通过两个 端口进行通信.
FTP Server 拥有命令端口 21 和数据传输端口 20.
FTP Client 发起命令, FTP Server 被动响应, 但是数据传输可以由任意一方发起.
FTP Client 首先使用一个随机的端口, 向 FTP Server 的命令端口 (端口号 20) 告知自己的端口号, FTP Server 向指定端口号发送应答消息.
1.2 FTP 命令
- ABOR - abort a file transfer
- CWD - change working directory
- DELE - delete a remote file
- LIST - list remote files
- MDTM - return the modifucation time of a file
- MKD - make a remote directory
- NLST - name list of remote directory
- PASS - send password
- PASV - enter passive mode
- PORT - open a data port
- PWD - print working directory
- QUIT - terminate the connection
- RETR - retrieve a remote file
- RMD - remove a remote directory
- RNFR - rename from
- RNTO - rename to
- SITE - site-specific commands
- SIZE - return the size of a file
- STOR - store a file on the remote host
- TYPE - set transfer type
- USER - send username
来源: http://www.bubuko.com/infodetail-3068833.html