0 votes

I use this code:

var client = new Ftp();

client.ReceiveTimeout = TimeSpan.FromSeconds(60);
client.SendTimeout = TimeSpan.FromSeconds(60);
client.KeepAliveDuringTransfer(TimeSpan.FromSeconds(30));
client.KeepAliveTcp(TimeSpan.FromMinutes(10), TimeSpan.FromSeconds(1));

client.Upload(remotePath, localPath);

And sometimes, on remote ftp, I get empty files.
Are there any pieces of advise for such situation?

by (200 points)
edited by

1 Answer

0 votes

If there is no exception on client side, it is hard to advise anything.
It means the transfer was successful and no error occurred.

It is impossible for Ftp.dll to truncate, remove or lost data.

Are you sure that the local files are not empty?

by (297k points)
Can't guarantee 100%. It needs time to investigate. That's what i'm doing right now.
We've found exception on client side:
"Connection closed; aborted transfer of /inbox/CONTRL_54263453_20141209095545450.xml"

Connection closed, but empty file is created on remote side.
Is there a way to avoid this? I.e the desired behavior - file is created only if file is fully transfered.
Who closes the connection? Antivirus? Server? It is the server that creates the file and doesn't remove it on aborted transfer.
You can delete it manually if the file size is different.
...