Home Forums .NET libraries Xceed SFTP/FTP for .NET FTP command execution has timed-out

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

    Bye,
    I have a thread that every 30 seconds try do download a file, but after the first correctly download I receive the error “FTP command execution has timed-out”.

    This is my code:

    Xceed.Ftp.Licenser.LicenseKey = “xxx”;
    AsyncFtpClient client = new AsyncFtpClient();

    IAsyncResult result = client.BeginConnect(“remoteHost”, null, null);
    client.EndConnect(result);
    client.Login(“remoteUser”, “remotePassword”);

    bool connected = false;
    connected = client.Connected;

    if (connected)
    {
    client.ChangeCurrentFolder(“remotePath”);
    result = client.BeginReceiveFile(fileName, xmlPath, null, null);
    client.EndReceiveFile(result);
    }

    IAsyncResult result = client.BeginDisconnect( null, null );
    client.EndDisconnect( result );

    It’s strange because if i try with a simple ftp client to download the same file I have no problem.

    Please help me.

    Thanks, Matteo Aldegheri

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by aldegheri.m (had 3133 views)

    Xceed Support
    Member
    Post count: 5658

    When using async FTP operations, you need to wait until the “Begin” counterpart returns with a completed state before calling the “End” counterpart. For example,

    AsyncFtpClient ftp = new AsyncFtpClient();

    IAsyncResult result = http://ftp.BeginConnect( “localhost”, null, null );

    while( !result.IsCompleted )
    Application.DoEvents();

    http://ftp.EndConnect( result );

    result = http://ftp.BeginLogin( null, null );

    while( !result.IsCompleted )
    Application.DoEvents();

    http://ftp.EndLogin( result );

    A full example of how to receive a file in async mode is available at the following URL:
    http://doc.xceedsoft.com/products/ftpNet/doc/sources/how_to_receive_a_file.htm

    If, once you have correctly implemented the async functionnalities the issue still persists, please let me know and I will investigate the issue further.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Jenny [Xceed] (had 3490 views)

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