Home Forums .NET libraries Xceed SFTP/FTP for .NET Getting error on SendMultipleFiles

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #21299 |

     Getting error message

    Public member ‘Text’ on type ‘Short’ not found.

    at Xceed.Ftp.Engine.FtpCommandSequence.EndExecute(IAsyncResult asyncResult)

    at Xceed.Ftp.FtpClient.DoExecuteCommand(FtpCommandChannel commandChannel, BaseFtpCommand command)

    at Xceed.Ftp.FtpClient.DoSendMultipleFiles(FtpCommandChannel commandChannel, SendMultipleFilesFtpCommandSequence sequence)

    at Xceed.Ftp.FtpClient.SendMultipleFiles(String localFileMask, Boolean recursive, Boolean recreateFolderStructure)

    at WebSupport.frmFTPBackup.StartUpload(String vGuid, String vFolderName) in C:\VB Projects\Code\JP7\WebSupport\Forms\frmFTPBackup.vb:line 501

    Below is my code in the form frmFTPBackup. Am trying to upload everything in a folder using mask <folder>\*  

    Below is the code, really copied the Send Multiple files using the Snippet Explorer Xceed provides

    #Region

    “FTP Related”

    Private Function StartUpload(ByVal vGuid As String, ByVal vFolderName As String) As Boolean

    Dim blnReturn As Boolean

    Try

    ‘Xceed licensing

    Xceed.Ftp.Licenser.LicenseKey =

    “XXXXX” ‘From 12/19/2009

    Dim client As New FtpClient()

    ‘ Let’s trace commands and replies to the console.

    ftplogfile =

    My.Computer.FileSystem.SpecialDirectories.Temp & “\” & vGuid & “.log”

    client.TraceWriter =

    New System.IO.StreamWriter(ftpLogFile, True)

    lnkFtpLog.Text =

    “FTP Command log”

    ‘ We want all events to be raised on the main UI thread.

    client.SynchronizingObject =

    Me

    ‘ Generally, when you make file transfers, you want to report the

    ‘ progress, for example using a progress bar. The FtpClient exposes

    ‘ a very powerful event called FileTransferStatus. For multiple files

    ‘ transfer, you may also want to get notified for each file about to

    ‘ be received or sent, using either the ReceivingFile or SendingFile

    ‘ events. You may also trap any error on one file transfer and make

    ‘ the method ignore this error and proceed with the next file, using

    ‘ the MultipleFileTransferError event.

    AddHandler client.FileTransferStatus, AddressOf Me.OnFileTransferStatus

    AddHandler client.SendingFile, AddressOf Me.OnSendingFile

    AddHandler client.MultipleFileTransferError, AddressOf Me.OnFileTransferError

    ‘ We will connect to the following FTP server, using the specified

    ‘ username and password. You must have rights to create files on

    ‘ that server.

    Dim hostname As String = “testbox” ‘txtHostName.EditValue

    Dim username As String = “username” ‘txtFTPUserName.EditValue

    Dim password As String = “password” ‘txtFtpPassword.EditValue

    Try

    ‘ Connect …

    client.Connect(hostname)

    ‘client.PassiveTransfer = True

    ‘client.Timeout = 60

    ‘ … and log-in.

    client.Login(username, password)

    ConsoleAddLine(

    “Logged-into “ & hostname)

    ‘client.ChangeCurrentFolder(“upload”)

    ‘ConsoleAddLine(“Directory changed to \upload”)

    ‘client.CreateFolder(vGuid)

    ‘ConsoleAddLine(“\upload\” & vGuid & ” directory created on server”)

    ‘client.ChangeCurrentFolder(“\upload\” & vGuid & “\”)

    ‘ConsoleAddLine(“Directory changed to \upload\” & vGuid & “\”)

    ‘show the progress bar

    prg.Visible =

    True

    btnCancel.Text =

    “End”

    ‘Send more than one file

    client.SendMultipleFiles(vFolderName &

    “*”, False, False)

    Catch Ex As Exception

    MessageBox.Show(Ex.Message & vbCrLf & Ex.StackTrace) ‘<– get the error here

    Finally

    Try

    If client.Connected Then

    client.Disconnect()

    End If

    Catch

    End Try

    ‘hide the progress bar

    prg.Visible =

    False

    ConsoleAddLine(

    “Disconnected!”)

    ‘ Unsubscribe from events.

    RemoveHandler client.FileTransferStatus, AddressOf Me.OnFileTransferStatus

    RemoveHandler client.SendingFile, AddressOf Me.OnSendingFile

    RemoveHandler client.MultipleFileTransferError, AddressOf Me.OnFileTransferError

    End Try

    Catch ex As Exception

    pLogger(

    “frmFTPBackup.StartUpload”, System.Reflection.MethodBase.GetCurrentMethod.Name() & “:” & ex.Message.ToString, EventLogEntryType.Warning)

    Finally

    StartUpload = blnReturn

    End Try

    End Function

    Private Sub OnFileTransferStatus(ByVal sender As Object, ByVal e As FileTransferStatusEventArgs)

    ‘ The event argument structure exposes many useful informations.

    ‘ In the case of a multiple file transfer, the number of bytes

    ‘ transferred for the current file and all files are examples

    ‘ of relevant values. Let’s update the progress bar based on the

    ‘ total percentage, and update the form’s title with the current

    ‘ file’s percentage.

    prg.EditValue = e.AllBytesPercent

    prg.EditValue.Text =

    “Sending file “ + e.LocalFilename + ” (“ + e.BytesPercent.ToString() + “%)”

    End Sub

    Private Sub OnSendingFile(ByVal sender As Object, ByVal e As TransferringFileEventArgs)

    ‘ Simply write a message stating the file transfer is starting.

    ConsoleAddLine(

    “Sending file “ & e.LocalFilename)

    End Sub

    Private Sub OnFileTransferError(ByVal sender As Object, ByVal e As MultipleFileTransferErrorEventArgs)

    ‘ The event argument structure will tell you what exception is about

    ‘ to be thrown, and the file involved. You can set the Action property

    ‘ to tell the librayr to either Abort (let the method throw that

    ‘ exception), Ignore (continue with next file), or Retry (try to

    ‘ transfer the same file again). For this sample, we will echo any

    ‘ error, and ignore the file.

    ConsoleAddLine(

    “An error occured while sending “ & e.RemoteItemName)

    ConsoleAddLine(e.Exception.Message)

    ConsoleAddLine(e.RemoteItemName &

    ” will be skipped.”)

    e.Action = MultipleFileTransferErrorAction.Ignore

    End Sub

    Private Sub ConsoleAddLine(ByVal vMsg As String)

    ‘txtConsole.AppendText(Now & “: ” & vMsg & vbCrLf)

    ‘Console.WriteLine(Now & “: ” & vMsg)

    End Sub

    #End

    Region

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Anup (had 2012 views)

    User (Old forums)
    Member
    Post count: 23064

     

    My FTP trace log shows the following:: Server is a regular IIS 7.0 server running on my Windows 7 PC. 

    Connected to 192.168.56.1:21 on 4/24/2010 @ 12:18:48 PM
    < 220-Microsoft FTP Service
    < 220 Anup PC
    > USER Anup
    < 331 Password required for Anup.
    > PASS *****
    < 230-Welcome to Anup’s PC
    <     Directory has 10,727,710,720 bytes of disk space available.
    < 230 User logged in.
    > PWD
    < 257 “/” is current directory.
    > TYPE I
    < 200 Type set to I.
    > PASV
    < 227 Entering Passive Mode (192,168,56,1,197,153).
    > STOR BUCat1.xml
    Data connection established with 192.168.56.1:50585 on 4/24/2010 @ 12:18:48 PM
    < 150 Opening BINARY mode data connection.
    > QUIT
    < 500 ‘�QUIT ‘: command not understood.
    Disconnected from 192.168.56.1:21 on 4/24/2010 @ 12:18:50 PM

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Anup (had 264 views)

    User (Old forums)
    Member
    Post count: 23064

     

    Figured this out. I was using another 3rd Party Vendors Form hence the Synchronizing was probably not working. Changed it to use a Windows Regular Form and it worked like a charm!

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Anup (had 1388 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.