Don't always get a 226 Transfer OK at the end of an FTP upload

大憨熊 提交于 2019-12-11 05:53:00

问题


With an FTP client I've written I will sometimes receive a 226 Transfer OK message from the FileZilla server after an upload completes, and sometimes I won't ever receive anything. And it's not that the client disconnected before the 226 Transfer OK was received, because I can see on the server that FileZilla never sent it.

I need to know when the server has received the complete upload, because I otherwise do not know if the whole file made it to the network before I close the connection.

Any ideas what might cause the unreliability of the 226 Transfer OK message? What actually triggers it to be sent?


回答1:


I figured it out myself! I found that it's the FIN/ACK message sent by the client on the data socket port that prompts the FileZilla server to send the 226 Transfer OK message on the control socket port (after sending its own FIN/ACK in response on the data socket port).

In WinRT, it's the closing of the data socket that causes the FIN/ACK message to be sent by the client.

So, the proper order for closing an FTP connection is (after the last data packet is sent) to close the data socket, wait for the 226 Transfer OK message on the control socket, send the QUIT message on the control socket, then close the control socket.



来源:https://stackoverflow.com/questions/15343022/dont-always-get-a-226-transfer-ok-at-the-end-of-an-ftp-upload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!