OK, I found a work-around for this problem. Here's the code I use to deal with it:
try {
uploadSucceded = true;
ftp.UploadStream(stream, zipFile);
} catch (EnterpriseDT.Net.Ftp.ControlChannelIOException) {
// we seem to have a problem with the server - it
// closes the connection after the transfer succeeds
// so if we get here, then check the file size to see
// if it transferred completely and if so then declare
// success and move to the next file
try {
TRACE("Control Channel Exception: verifying file size", 1);
if (ftp.IsConnected) {
ftp.Close();
}
ftp.Connect();
remoteFileSize = ftp.GetSize(zipFile);
if (remoteFileSize == localFileSize) {
TRACE("Control Channel Exception: file sizes match", 1);
uploadSucceded = true;
} else {
TRACE("Control Channel Exception: attempting resume", 1);
ftp.ResumeTransfer();
ftp.UploadStream(stream, zipFile, true);
}
} catch (Exception ex) {
uploadSucceded = false;
xferStatus = TransferStatus.UploadFail;
ftpErrMsg = ex.Message;
TRACE("FTP resume exception : " + ftpErrMsg, 1);
}
} catch (Exception ex) {
// if we have an exception, then the upload failed
uploadSucceded = false;
xferStatus = TransferStatus.UploadFail;
ftpErrMsg = ex.Message;
TRACE("FTP upload exception : " + ftpErrMsg, 1);
}
I need a lot more testing but this seems to work around this problem.