Resume File Transfer After Disconnect - WeOnlyDo Discussion board

Resume File Transfer After Disconnect (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Christian, Monday, August 17, 2009, 23:31 (5578 days ago)

We are trying to send a file to an external client, but they appear to have an auto-disconnect after 15 minutes.

I was hoping to resolve the issue by setting the Resume property to TRUE, but it seems that the Resume property doesn't reconnect after a disconnection. So, I tried the following code:

[code]
while (retryCount < 3)
{
try
{
if (!ftp.State.Equals( Connected ))
{
ftp.Connect();
}
ftp.PutFile(SourceFilePath, DestinationFilePath);
}
catch (Exception ex)
{
retryCount++;
if (retryCount > 2)
{
return Error: + ex.Message + + ftp.State;
}
}
}[/code]

The process runs longer than the original 15 minutes, but then I receive the following error message:

Error: Please disconnect first. Connected

So, the error is telling me to disconnect first, but the FTP State says that it's still connected. What am I missing? Am I using the Resume property correctly? Is there a better way to reconnect to a server and resume file transfer?

Thanks


Complete thread: