简体   繁体   中英

FtpWebRequest not continuing after failed connection

I am doing a project on FTP file-transfer using FtpWebRequest class. While transferring the file, if my network connection gets disconnected the file in the receiving end gets hanged. I am not able to process further even though I re-establish my network connection. After some time the file gets removed; then I am able to put the file again. What is the problem? Is the class is designed in that manner?

Receiving End Means - the machine in which the ftp server runs,and im the who sends the file from a machine without FTP.

What FTP server you are programming against? I think it is the server who prevents you from manipulating that file (which should be in unknown state) after building up a new connection.

Also when the network connection is disconnected, the underlying WinSock call is still expecting a response from the FTP server. So it hangs there. So if I were you, I will consider async calls, where I can cancel the call if it times out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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