NET FTP Library
SiteToSiteTransferFileAsync Method
Example 






KellermanSoftware.NetFtpLibrary Namespace > FTP Class : SiteToSiteTransferFileAsync Method
Transfer specified by name file from current FTP to destination FTP asynchronously.
Syntax
'Declaration
 
Public Sub SiteToSiteTransferFileAsync( _
   ByVal destination As FTP, _
   ByVal fileName As System.String _
) 
'Usage
 
Dim instance As FTP
Dim destination As FTP
Dim fileName As System.String
 
instance.SiteToSiteTransferFileAsync(destination, fileName)
public void SiteToSiteTransferFileAsync( 
   FTP destination,
   System.string fileName
)
public procedure SiteToSiteTransferFileAsync( 
    destination: FTP;
    fileName: System.String
); 
public function SiteToSiteTransferFileAsync( 
   destination : FTP,
   fileName : System.String
);
public: void SiteToSiteTransferFileAsync( 
   FTP* destination,
   System.string* fileName
) 
public:
void SiteToSiteTransferFileAsync( 
   FTP^ destination,
   System.String^ fileName
) 

Parameters

destination
fileName
Example
//Connect to the source
FTP ftpSource = new FTP();
ftpSource.HostAddress = "source server address";
ftpSource.UserName = "source user name";
ftpSource.Password = "source password";
ftpSource.EnableLogging();
ftpSource.Connect();
 
//Create a source directory on the source FTP server
ftpSource.CreateDirectory("SourceDir");
ftpSource.CurrentDirectory = "SourceDir";
 
//Create a test file and upload to the source directory
File.WriteAllText("test.txt", "This is a test");
ftpSource.UploadFile("test.txt", "test.txt");
 
//Connect to the destination
FTP ftpDest = new FTP();
ftpDest.HostAddress = "dest server address"; 
ftpDest.UserName = "dest user name";
ftpDest.Password = "dest password";
ftpDest.EnableLogging();
ftpDest.Connect();
 
//Create a dest directory on the dest FTP server
ftpDest.CreateDirectory("DestDir");
ftpDest.CurrentDirectory = "DestDir";
 
ftpSource.SiteToSiteTransferFile(ftpDest,"test.txt");
 
if (ftpDest.FileExists("test.txt"))
    Console.WriteLine("Success!");
'Connect to the source
Dim ftpSource As New FTP()
ftpSource.HostAddress = "source server address"
ftpSource.UserName = "source user name"
ftpSource.Password = "source password"
ftpSource.EnableLogging()
ftpSource.Connect()
 
'Create a source directory on the source FTP server
ftpSource.CreateDirectory("SourceDir")
ftpSource.CurrentDirectory = "SourceDir"
 
'Create a test file and upload to the source directory
File.WriteAllText("test.txt", "This is a test")
ftpSource.UploadFile("test.txt", "test.txt")
 
'Connect to the destination
Dim ftpDest As New FTP()
ftpDest.HostAddress = "dest server address"
ftpDest.UserName = "dest user name"
ftpDest.Password = "dest password"
ftpDest.EnableLogging()
ftpDest.Connect()
 
'Create a dest directory on the dest FTP server
ftpDest.CreateDirectory("DestDir")
ftpDest.CurrentDirectory = "DestDir"
 
ftpSource.SiteToSiteTransferFile(ftpDest,"test.txt")
 
If ftpDest.FileExists("test.txt") Then
    Console.WriteLine("Success!")
End If
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

FTP Class
FTP Members