Hello,
the thing is that a single FTP server session can not do multiple operations simultaneously. Nevertheless you can establish two sessions for the same user to work around this limitation:
var ftp1 = new Rebex.Net.Ftp();
ftp1.Connect(hostname, port);
ftp1.Login(username, password);
var ftp2 = new Rebex.Net.Ftp();
ftp2.Connect(hostname, port);
ftp2.Login(username, password);
// make copy of file
using (var stream = ftp1.GetDownloadStream(filePath))
{
ftp2.PutFile(stream, filePath1);
}
However, please be aware that file data is actually going to be downloaded by the client and uploaded again, which is inefficient. If the server has been configured to allow server-to-server transfers, the following approach would eliminate the round-trip:
// copy a single file to the destination server
ftp1.CopyToAnotherServer(ftp2, filePath, filePath1);