简体   繁体   English

FTP文件传输,客户端可以关闭数据连接吗? 如果是这样怎么办?

[英]FTP file transfer, can the client close the data connection? if so how?

  1. After the control connection to port 21 is created, the FTP server sends the 220 (service ready) response on the control connection. 创建到端口21的控制连接后,FTP服务器在控制连接上发送220(服务就绪)响应。

  2. The client sends the USER command. 客户端发送USER命令。

  3. The server responds with 331 (user name is OK, a password is required). 服务器以331响应(用户名确定,需要密码)。

  4. The client sends the PASS command. 客户端发送PASS命令。

  5. The server responds with 230 (user login is OK). 服务器以230响应(用户登录正常)。

  6. The client issues a passive open on an ephemeral port for the data connection and sends the PORT command (over the control connection) to give this port number to the server. 客户端在临时端口上为数据连接发出被动打开,并发送PORT命令(通过控制连接)以将该端口号提供给服务器。

  7. The server does not open the connection at this time, but prepares itself for issuing an active open on the data connection between port 20 (server side) and the ephemeral port received from the client. 服务器此时不打开连接,但为在端口20(服务器端)和从客户端收到的临时端口之间的数据连接上发出活动打开做准备。 It sends the response 150 (data connection will open shortly). 它发送响应150(数据连接将很快打开)。

  8. The client sends the TYPE command. 客户端发送TYPE命令。

  9. The server responds with the response 200 (command OK). 服务器以响应200响应(命令“确定”)。

  10. The client sends the STRU command. 客户端发送STRU命令。

  11. The server responds with 200 (command OK). 服务器以200响应(命令确定)。

  12. The client sends the STOR command. 客户端发送STOR命令。

  13. The server opens the data connection and sends the response 250. 服务器打开数据连接并发送响应250。

  14. The client sends the file on the data connection. 客户端通过数据连接发送文件。 After the entire file is sent, the data connection is closed. 发送完整个文件后,数据连接将关闭。 Closing the data connection means end-of-file. 关闭数据连接意味着文件结束。

  15. The server sends the response 226 on the control connection. 服务器在控制连接上发送响应226。

  16. The client sends the QUIT command or uses other commands to open another data connection for transferring another file. 客户端发送QUIT命令或使用其他命令打开另一个数据连接以传输另一个文件。 In our example, the QUIT command is sent. 在我们的示例中,发送了QUIT命令。

  17. The server responds with 221 (service closing) and it closes the control connection. 服务器以221(服务关闭)响应,并关闭控制连接。


in point 14. 在第14点中

  1. The client sends the file on the data connection. 客户端通过数据连接发送文件。 After the entire file is sent, the data connection is closed. 发送完整个文件后,数据连接将关闭。 Closing the data connection means end-of-file. 关闭数据连接意味着文件结束。

does the client close the data connection? 客户端是否关闭数据连接?

if so how does it do that. 如果是这样,它是如何做到的。 just disconnects! 断开连接! or sends a disconnect command using the control connection? 或使用控制连接发送断开连接命令?

The default transmission mode is STREAM. 默认传输模式为STREAM。 On a stream file upload, the data connection is just closed. 在流文件上传中,数据连接刚刚关闭。 No command is sent. 没有发送命令。 Just close the connection. 只需关闭连接。

If you were to send a command, whatever you sent would be appended to the file. 如果要发送命令,则您发送的所有内容都会附加到文件中。

The stream mode is unreliable because there is no EOF marker. 由于没有EOF标记,因此流模式不可靠。 Also, you must reopen the connection for each additional file. 另外,您必须为每个其他文件重新打开连接。 It is better to use BLOCKED or COMPRESSED for reliability and will improve performance when sending multiple small files, though there is a small overhead for the protocol. 最好使用BLOCKED或COMPRESSED来提高可靠性,并在发送多个小文件时提高性能,尽管该协议的开销很小。

Use the MODE command to set the transmission mode. 使用MODE命令设置传输模式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM