Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4k views
in .NET FTP by
Whenever I Get() a large .zip file the program hangs in ValidateTransfer. My question is what does this method actually do and do i need to let it run?

I've tried stepping through to find what exactly is happening but have been unable to come up with anything. If someone has some steps to take to find a solution that would be acceptable as well.

4 Answers

0 votes
by (51.6k points)
When a transfer is complete the server sends a response code back to the client to inform it of the status of the transfer. ValidateTransfer() reads this code and processes it, throwing an exception if there was a problem reported and continuing otherwise.

Removing this method will result in the code being left in the read buffer which will confuse subsequent commands.

The reason why the connection is hanging at this point is that the server is not sending the response code.

A few questions:
  1. Has the file actually finished tranferring?
  2. If not, has it even started?
  3. Can you do directory listings?
  4. Have you checked the log for error messages?
  5. Have you tried other FTP clients such as the command-line ftp client or FileZilla?

    - Hans (EDT)
0 votes
by
Thank you for your response.



To answer your questions:

1. The file is finished downloading, and can be opened after the program is exited. The program is also able to be validated with 7zip.

3. I am using the directory listings in the program with a regular expression to determine which files should be downloaded, after comparing with the file information obtained by getting directory listings.

4. I'm not sure if I'm logging anything, any help there would be available.

5. I have not tried the command line ftp client, FileZilla has no problem with the file. I don't mind trying the command line, how would i go about that?

It would appear that the code where it actually gets "stuck" is the following

while ((count = ReadChunk(input, chunk, transferBufferSize)) > 0 && !cancelTransfer)
{
output.Write(chunk, 0, count);
size += count;
monitorCount += count;

if (BytesTransferred != null && monitorCount > monitorInterval)
{
BytesTransferred(this, new BytesTransferredEventArgs(remoteFile, size));
monitorCount = 0;
}
}

It keeps incrementing, for as long as im willing to let it go, long after the size is larger than the size of the actual file.

Thanks for your help.
0 votes
by
Above code snippet is from FTPClient.cs at approx line 2000
0 votes
by
Another question, if the server is not sending this response for the ftp client to pick up and use to be able to continue, is there a standard timeout, when you can say, I guess it's not coming?

Categories

...