Home Forums .NET libraries Xceed SFTP/FTP for .NET sporadic error by sending multible files

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

    Hello,
    i’am using the FTP for .NET Framework 4.2 because my application has to compatible with .NET 2.0.
    I have a problem by sending multible files. I get sporadic failues see below.
    This failure is similar the same as using an FtpConnection object and using the copy methods.
    But now i’am not using a FtpConnection object but an FtpClient object.

    My application has to store each file under a different target name on the server. If the transfer is completed the application rename the remote file to the original name. Therefore i can’t use the SendMultibleFiles method.

    I’ve tested the application on different FTP-Servers (my local FTP-Server, a server in our company and an external server at our hosting provider).
    On each server i’am getting sporadic errors by sending more than a few files. Each file is amount 300kB.

    The reported lines in the application output are:
    line 168: client.SendFile(file, onlyfilename + “.lock”);
    line 172: client.RenameFile(onlyfilename + “.lock”, onlyfilename);

    (i’ve deleted some comments in the source therefore the line differents)

    Where is the failure?
    Regards

    Jan

    ########## Application-Method ##########

    private void SendDataNormal(string folder, string searchPattern)
    {            
        FtpClient client = new FtpClient();
        client.RepresentationType = RepresentationType.Binary;

        // Connect
        client.Connect(hostname);

        client.Login(username, password);    

        // Send files
        foreach(string file in Directory.GetFiles(folder, searchPattern)) {
        string onlyfilename = file.Substring(file.IndexOf(“File_”));                             
        try
        {
            Console.WriteLine(“Trying: {0}”,file);        
            client.SendFile(file, onlyfilename + “.lock”);
            client.RenameFile(onlyfilename + “.lock”, onlyfilename);
            Console.WriteLine(” -> transfer and rename OK\n——————“);
        } catch(Exception e) {
            Console.WriteLine(“——- SendDataNormal -> Error ——-“);
            Console.WriteLine(“Message:\n{0}\n\nStackTrace:\n{1}”,e.Message, e.StackTrace);
            Console.WriteLine(“—————————————“);
        }                                
        }  

        disconnect(client);
    }

    ########## Application Output ##########

    Trying: C:\Data\File_20100509_204932-192_168_10_57.zip
     -> transfer and rename OK
    ——————
    Trying: C:\Data\File_20100509_210348-192_168_10_57.zip
     -> transfer and rename OK
    ——————
    Trying: C:\Data\File_20100509_210755-192_168_10_57.zip
     -> transfer and rename OK
    ——————
    Trying: C:\Data\File_20100509_210944-192_168_10_57.zip
     -> transfer and rename OK
    ——————
    Trying: C:\Data\File_20100509_211518-192_168_10_57.zip
     -> transfer and rename OK
    ——————
    Trying: C:\Data\File_20100509_211600-192_168_10_57.zip
     -> transfer and rename OK
    ——————
    Trying: C:\Data\File_20100509_211617-192_168_10_57.zip
     -> transfer and rename OK
    ——————
    Trying: C:\Data\File_20100509_211739-192_168_10_57.zip
     -> transfer and rename OK
    ——————
    Trying: C:\Data\File_20100509_212726-192_168_10_57.zip
     -> transfer and rename OK
    ——————
    Trying: C:\Data\File_20100509_213151-192_168_10_57.zip
     -> transfer and rename OK
    ——————
    Trying: C:\Data\File_20100509_213244-192_168_10_57.zip
    ——- SendDataNormal -> Error ——-
    Message:
    The FTP command execution timed-out.

    StackTrace:
       bei Xceed.Ftp.Engine.FtpCommandSequence.EndExecute(IAsyncResult asyncResult)
       bei Xceed.Ftp.FtpClient.DoExecuteCommand(FtpCommandChannel commandChannel, BaseFtpCommand command)
       bei Xceed.Ftp.FtpClient.DoRenameFile(FtpCommandChannel commandChannel, RenameFromFtpCommand renameFrom, RenameTo
    FtpCommand renameTo)
       bei Xceed.Ftp.FtpClient.RenameFile(String currentFilename, String newFilename)
       bei DataService.FileTransfer.SendDataNormal(String folder, String searchPattern) in C:\Dokumente un
    d Einstellungen\localuser\Eigene Dateien\Projekte\SicherungDaten\SicherungDaten\SicherungDaten\F
    ileTransfer.cs:Line 172.
    —————————————
    Trying: C:\Data\File_20100510_075522-192_168_10_57.zip
    ——- SendDataNormal -> Error ——-
    Message:
    The FTP command execution timed-out.

    StackTrace:
       bei Xceed.Ftp.Engine.FtpCommandSequence.EndExecute(IAsyncResult asyncResult)
       bei Xceed.Ftp.FtpClient.DoExecuteCommand(FtpCommandChannel commandChannel, BaseFtpCommand command)
       bei Xceed.Ftp.FtpClient.DoSendFile(FtpCommandChannel commandChannel, SendFileFtpCommandSequence sequence)
       bei Xceed.Ftp.FtpClient.SendFile(String localFilename, String remoteFilename)
       bei DataService.FileTransfer.SendDataNormal(String folder, String searchPattern) in C:\Dokumente un
    d Einstellungen\localuser\Eigene Dateien\Projekte\SicherungDaten\SicherungDaten\SicherungDaten\F
    ileTransfer.cs:Line 168.
    —————————————

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

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi Jan,

    We would need the log of the communications between the client and the server to investigate further.

    Could you set the TraceWriter property to get the log and send it to us?
       FtpClient.TraceWriter = new StreamWriter( @”D:\ftp.log”, true );

    Also, if there’s an inner exception, please send it as well as it could also be useful.

    Please send it by email to support@xceed.com and include “case 133653” in the email title. Thank you.

     

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

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