edtFTPnet/Free - Open-source FTP component for .NET | Download
 How to use FTP events

Events are useful for providing feedback on the progress of FTP operations.  For example, the BytesTransferred event fires during a file transfer each time another n bytes have been transferred, where n is equal to FTPConnection.TransferNotifyInterval.  An event such as this may be used to provide progress feedback during long transfer operations.

Handling events is done using delegates in the same way as other .NET events.  For example, to handle the Connected event, an event handler must be defined:

   private void ftpConnection_Connected(object sender,
                EnterpriseDT.Net.Ftp.FTPConnectionEventArgs e)
   {
      Print("Connected to " + e.ServerAddress + ":" + e.ServerPort);
   }

A delegate for this event-handler must then be added to the event:

   ftpConnection.Connected +=
                
new FTPConnectionEventHandler(ftpConnection_Connected);

Once this has been done, the ftpConnection_Connect method will be called when a connection with the server has been established.
The following events relate to specific FTP operations. Most events are available in FTPConnection:

Closed
Occurs when the component has closed its connection to the server.
Closing
Occurs when the component is about to close its connection to the server.
Connected
Occurs when the component has connected to the server.
Connecting
Occurs when the component is connecting to the server.
Deleted
Occurs when a file has been deleted from the server.
Deleting
Occurs when a file is about to be deleted from the server.
DirectoryChanged
Occurs when the working directory on the server has been changed.
DirectoryChanging
Occurs when the working directory on the server is about to be changed.
Downloaded
Occurs when a file has been downloaded from the server.
Downloading
Occurs when a file is about to be downloaded from the server.
LoggedIn
Occurs when the component has logged in.
LoggingIn
Occurs when the component is about to log in.
RenamedFile
Occurs when a remote file has been renamed.
RenamingFile
Occurs when a remote file is about to be renamed.
Uploaded
Occurs when a file has been uploaded to the server.
Uploading
Occurs when a file is about to be uploaded to the server.

The following events are of a more general nature and can occur across a range of FTP operations:


BytesTransferred
Occurs every time a specified number of bytes of data have been transferred.
CommandSent
Occurs when a command is sent to the server.
ReplyReceived
Occurs when a reply is received from the server.