Home Forums .NET libraries Xceed SFTP/FTP for .NET FtpInvalidStateExcption cannot perform ??

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

    Here is my code:

    Imports Xceed.Ftp

    Public Class Form1

    Private WithEvents FtpClient As AsyncFtpClient
    Private HostName As String = “xxx.xxx.xxx.xx”
    Private UserID As String = “user”
    Private UserPA As String = “gogo”
    Private RemoteDir As String
    Private m_CurrentDirectory As String

    Public Sub New()
    InitializeComponent()
    FtpClient = New AsyncFtpClient
    With FtpClient
    .PassiveTransfer = True
    .SynchronizingObject = Me
    .Encoding = System.Text.Encoding.GetEncoding(950)
    End With
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Dim result As IAsyncResult

    With FtpListView
    .MultiSelect = True
    .Columns.Add(“Name”, 300, HorizontalAlignment.Left)
    .Columns.Add(“Size”, 100, HorizontalAlignment.Left)
    .Columns.Add(“Type”, 100, HorizontalAlignment.Left)
    .Columns.Add(“Time”, 100, HorizontalAlignment.Left)
    .SmallImageList = imgSmallIcon
    .View = View.Details
    End With
    FtpClient.Timeout = 120

    result = FtpClient.BeginConnect(HostName, Nothing, Nothing)
    While Not result.IsCompleted
    Application.DoEvents()
    End While
    FtpClient.EndConnect(result)

    result = FtpClient.BeginLogin(UserID, UserPA, Nothing, Nothing)
    While Not result.IsCompleted
    Application.DoEvents()
    End While
    FtpClient.EndLogin(result)

    result = FtpClient.BeginChangeCurrentFolder(“Program Files\IGS”, Nothing, Nothing)
    While Not result.IsCompleted
    Application.DoEvents()
    End While
    FtpClient.EndChangeCurrentFolder(result)

    Result = FtpClient.BeginChangeToParentFolder(Nothing, Nothing)
    While Not result.IsCompleted
    Application.DoEvents()
    End While
    FtpClient.EndChangeToParentFolder(result)

    ====when run this code will have error======
    <<Cannot perform the requested operation because the FTP client is already processing a command.>>
    ====could tell me how to solved it ====

    result = FtpClient.BeginChangeCurrentFolder(“Program Files\User”, Nothing, Nothing)
    While Not result.IsCompleted
    Application.DoEvents()
    End While
    FtpClient.EndChangeCurrentFolder(result)

    ————————————————————————

    end sub

    end class

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

    User (Old forums)
    Member
    Post count: 23064

    when i add this code will have error

    result = FtpClient.BeginChangeToParentFolder(Nothing, Nothing)
    While Not result.IsCompleted
    Application.DoEvents()
    End While
    FtpClient.EndChangeToParentFolder(result)

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

    User (Old forums)
    Member
    Post count: 23064

    This is a bug with the BeginChangeToParentFolder() method. It will be corrected in our next release. If you want to be notified when the release becomes available, please send a request regarding this issue to support@xceedsoft.com.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by André (had 4101 views)

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