NET FTP Library
Cancel Method
Example 






KellermanSoftware.NetFtpLibrary Namespace > FTP Class : Cancel Method
Cancels any async transfers
Syntax
'Declaration
 
Public Sub Cancel() 
'Usage
 
Dim instance As FTP
 
instance.Cancel()
public void Cancel()
public procedure Cancel(); 
public function Cancel();
public: void Cancel(); 
public:
void Cancel(); 
Example
FTP ftp = new FTP(); //Trial Mode            
//FTP ftp = new FTP("place user name here", "place license key here");
 
// set the name of the FTP server( its URL )
ftp.HostAddress = "ftp.fsz.bme.hu"; // a hungarian university. change this to your ftp server
ftp.UserName = "anonymous"; // replace with your user name
ftp.Password = "user@mail.com"; // replace with your password
 
ftp.UploadDirectoryAsync("C:\\Download", "TestDir");
 
//we wait 1 second for data to be Transferred 
System.Threading.Thread.Sleep(1000);
 
//Cancels any async transfers 
System.Console.WriteLine("We are canceling any async transfer");
ftp.Cancel();
 
System.Console.WriteLine("Async operations {0) cancelled", ftp.IsBusy == true ? "have not" : "have been" );
Dim ftp As FTP = New FTP() 'Trial Mode
'FTP ftp = new FTP("place user name here", "place license key here");
 
' set the name of the FTP server( its URL )
ftp.HostAddress = "ftp.fsz.bme.hu" ' a hungarian university. change this to your ftp server
ftp.UserName = "anonymous" ' replace with your user name
ftp.Password = "user@mail.com" ' replace with your password
 
ftp.UploadDirectoryAsync("C:\\Download", "TestDir")
 
'we wait 1 second for data to be Transferred
System.Threading.Thread.Sleep(1000)
 
'Cancels any async transfers
System.Console.WriteLine("We are canceling any async transfer")
ftp.Cancel()
 
If ftp.IsBusy = True Then
    System.Console.WriteLine("Async operations {0) cancelled","have not")
Else
    System.Console.WriteLine("Async operations {0) cancelled","have been")
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