This blog post describes a problem with the Microsoft FTP Server.
Chilkat Customer Problem (resolution follows):
I am trying to test the resume functionality but receive the error “550 abc123.txt: The process cannot access the file because it is being used by another process”. The log generated is below:
<ChilkatLog>
<PutFile>
<LocalFilename>C:\temp\abc123.txt</LocalFilename>
<RemoteFilename>abc123.txt</RemoteFilename>
<DllDate>Nov 6 2007</DllDate>
<Username>chilkat</Username>
<Component>.NET 2.0</Component>
<info>Active transfer mode</info>
<MyIP>222,222,222,222,8,157</MyIP>
<SetupDataSocketTimeMS>62</SetupDataSocketTimeMS>
<size>866880</size>
<FtpResponse23>550 abc123.txt: The process cannot access the file because it is being used by another process.</FtpResponse23>
<error>Failed.</error>
</PutFile>
</ChilkatLog>
Here’s what I do to test the resume functionality (in my VB.NET application):
1) Connect to FTP server and start sending a file (using a public ftp2 object named ftp)
2) I deliberately pull out the network cable from my PC so the transfer fails half way through
3) The PutFile method returns False (as expected)
4) I then set the RestartNext property to True
5) I reconnect to the FTP server (using the same ftp2 object, ftp) before recalling the PutFile method and passing the same localFilename and remoteFilename values that were used when the transfer failed.
Problem Solution
For your information, after further testing (i.e. testing the resume functionality of other FTP tools), the bug stated in the Microsoft article does not apply in this instance to my FTP server (which is 2003 Web Edition).
The reason I am receiving the error: 550 : The process cannot access the file because it is being used by another process is because I am not waiting long enough for the FTP server to release the file, before I try the resume.
I now use the ftp2.SleepMs property (I did not know this existed!) and wait just over 2 minutes (I think 2 minutes is the time period the FTP server will keep a file open before it decides to release it). I am waiting 150 seconds before I do the retry.