Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.9k views
in .NET FTP by (200 points)
Hello, I

3 Answers

0 votes
by (162k points)
It looks to me like DownloadFile is being called before an existing download is completed.

PASV is called prior to RETR.
0 votes
by (200 points)
The RETR in the log is from an FTPConnection.Exists method call, which occurs immediately prior to the DownloadFile call. So it looks like the sequence of events is:

Exists called (issues RETR command)
DownloadFile called (issues PASV command)
Server responds to the RETR with "226 ASCII Transfer complete."
DownloadFile, expecting a response to the PASV command, throws an exception and never issues its own RETR command.

Since this is all happening in the FTPConnection method calls I don't think I can do anything in my code to alter the sequence.

While I wait for a response on the forum I'm going to modify the code to close and re-open the connection between the Exists and DownloadFile calls and see if that solves the problem. Perhaps this is what I'm supposed to be doing anyway? I haven't run into this issue before and I use this sequence of calls in many, many download processes.

Thanks for your continued assistance.
0 votes
by (200 points)
I figured it out once I realized that your Exists method is attempting a SIZE, then a MDTM, then a RETR command. I should have posted the entire log. This particular server does not allow the SIZE or MDTM commands, and it looks like the Exists method has some trouble parsing the response from the RETR command. I came up with the workaround of getting the file list and looking for my file, rather than calling the Exists method.

Then I found the comment below from support in the forum at (http://www.enterprisedt.com/forums/viewtopic.php?t=3076):

***
This is happening because the commands are getting mixed up.

The Exists() method is a bit of a hack - there is no exists functionality in FTP.

Try using GetFiles() to get the file list, and check for the filename in there rather than use Exists().
***

So, it looks like this is a known issue. I've tested the workaround and it's suitable for my purposes.

Thanks for a good product.

Categories

...