网络协议之FTP协议
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