Xceed .NET Libraries Documentation
Xceed.Ftp Assembly / Xceed.Ftp Namespace / FtpClient Class / ReplyReceived Event
Example


In This Topic
    ReplyReceived Event
    In This Topic
    Raised once for each reply received from the FTP server. If a reply contains multiple lines, they will be received as a group.
    Syntax
    'Declaration
     
    Public Event ReplyReceived As ReplyReceivedEventHandler
    'Usage
     
    Dim instance As FtpClient
    Dim handler As ReplyReceivedEventHandler
     
    AddHandler instance.ReplyReceived, handler
    public event ReplyReceivedEventHandler ReplyReceived
    Event Data

    The event handler receives an argument of type ReplyReceivedEventArgs containing data related to this event. The following ReplyReceivedEventArgs properties provide information specific to this event.

    PropertyDescription
    Gets the reply that was received from the FTP server.  
    Remarks

    To be notified when a command is sent to the FTP server, subscribe to the CommandSent event.

    This event is the equivalent of the LoggingCommandLine event of the ActiveX version of the Xceed FTP Library.

    Example
    The following example demonstrates how to use the ReplyReceived event to display logging information. Normally, the commands that are sent to the FTP server would also be displayed via the CommandSent event. This example assumes that you are in a Windows application and that the form contains a listbox.
    Xceed.Ftp.Licenser.LicenseKey = "FTNXX-XXXXX-XXXXX-XXXX" ' Set license key here to deploy    
    
    Dim ftp As New FtpClient()
    
    AddHandler ftp.ReplyReceived, AddressOf Me.reply_received
    
    ftp.Connect( "localhost" )
    ftp.Login()
    
    ftp.GetFolderContents()
    
    ftp.Disconnect()
    
    Private Sub reply_received( ByVal sender As Object, ByVal e As ReplyReceivedEventArgs )
    
      Dim line As String
      For Each line in e.Reply.Lines
      
        listBox1.Items.Add( "<<" + line )
        listBox1.SelectedItem = listBox1.Items.Count - 1
      Next line 
    End Sub
    Xceed.Ftp.Licenser.LicenseKey = "FTNXX-XXXXX-XXXXX-XXXX" // Set license key here to deploy 
    
    FtpClient ftp = new FtpClient();
    
    ftp.ReplyReceived += new ReplyReceivedEventHandler( this.reply_received );
    
    ftp.Connect( "localhost" );
    ftp.Login();
    
    ftp.GetFolderContents();
    
    ftp.Disconnect();
    
    private void reply_received( object sender, ReplyReceivedEventArgs e )
    {
      foreach( string line in e.Reply.Lines )
      {
        listBox1.Items.Add( "<<" + line );     
      }
      
      listBox1.SelectedItem = listBox1.Items.Count - 1;
    }
    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