public event AsyncCompletedEventHandler DeleteFileCompleted
Shows how to use DeleteFileAsync method to asynchronously delete a file (Task-based approach).
using System; using ComponentPro.IO; using ComponentPro.Net; using ComponentPro; ... // Create a new class instance. Ftp client = new Ftp(); // Connect to the FTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("userName", "password"); // ... // Delete remote file '/temp.tmp'. await client.DeleteFileAsync("/temp.tmp"); // ... // Disconnect. client.Disconnect();
Shows how to use DeleteFileAsync method to asynchronously delete a file (Event-based approach).
using System; using System.ComponentModel; using ComponentPro.IO; using ComponentPro.Net; using ComponentPro; ... static void Main() { // Create a new class instance. Ftp client = new Ftp(); // Connect to the FTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("userName", "password"); // ... // Register an event handler. client.DeleteFileCompleted += client_DeleteFileCompleted; // Delete remote file '/temp.tmp'. client.DeleteFileAsync("/temp.tmp"); // ... // Disconnect. client.Disconnect(); } static void client_DeleteFileCompleted(object sender, AsyncCompletedEventArgs e) { // Ftp client = (Ftp)sender; if (e.Error != null) Console.WriteLine("Error: " + e.Error.Message); }
Shows how to use DeleteFileAsync method to asynchronously delete a file (Task-based approach).
using System; using ComponentPro.IO; using ComponentPro.Net; using ComponentPro; ... // Create a new class instance. Sftp client = new Sftp(); // Connect to the SFTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("userName", "password"); // ... // Delete remote file '/temp.tmp'. await client.DeleteFileAsync("/temp.tmp"); // ... // Disconnect. client.Disconnect();
Shows how to use DeleteFileAsync method to asynchronously delete a file (Event-based approach).
using System; using System.ComponentModel; using ComponentPro.IO; using ComponentPro.Net; using ComponentPro; ... static void Main() { // Create a new class instance. Sftp client = new Sftp(); // Connect to the SFTP server. client.Connect("myserver"); // Authenticate. client.Authenticate("userName", "password"); // ... // Register an event handler. client.DeleteFileCompleted += client_DeleteFileCompleted; // Delete remote file '/temp.tmp'. client.DeleteFileAsync("/temp.tmp"); // ... // Disconnect. client.Disconnect(); } static void client_DeleteFileCompleted(object sender, AsyncCompletedEventArgs e) { // Sftp client = (Sftp)sender; if (e.Error != null) Console.WriteLine("Error: " + e.Error.Message); }