Archived Forum Post

Index of archived forum posts


Chilkat Ftp2 - file cuts off at a particular point at each downlond

Jun 10 '14 at 14:18

I have used Chilkat.Ftp2 successfully in numerous scenarios and downloaded many different files successfully although I have a problem with one particular file. It only partially downloads and cuts off at exactly the same point each time.

The file is a comma delimited, the line where it cuts of is -

"Guildford road","Chertsey","",""

The point where it cuts off is -

Guildford road","Cher

As you can see there are know unusual characters which may cause the download to prematurely end. I have recreate the file and attempted the download again but it still cuts off at exactly the same point. I'm using FTP protocol to transfer. All other files within this solution download completely.

Any help would be much appreciated?




Can you post the code you are using, and the contents of the LastErrorText property immediately after the method call when the download is "finished"?


My code is -

DIM AuditPathnFileName Dim filesys, filetxt, getname, path

AuditPathnFileName="***FTP_LOG.txt" Set objFSO=CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.CreateTextFile(AuditPathnFileName,True)

set ftp = CreateObject("Chilkat.Ftp2")

' Any string unlocks the component for the 1st 30-days. success = ftp.UnlockComponent("*****") If (success <> 1) Then objFile.Write ftp.LastErrorText & vbCrLf objFile.Close WScript.Quit End If

ftp.Hostname = "FTP.*.COM" ftp.Username = "*" ftp.Password = "****"

' Set the Passive property to use Passive mode FTP transfers. ftp.Passive = 1

objFile.Write "Connecting to FTP Server : " & Now & vbCrLf

' Connect and login to the FTP server.

i = 0

DO WHILE (i<50) success = ftp.Connect()

if success = "1" then exit do

objFile.Write "Attempt : " & I & " :" & Now & vbCrLf
    objFile.Write ftp.LastErrorText & " :" & Now & vbCrLf

'Number of connection attempts required
IF i= 5 then 
    objFile.Write "Number of attempted connections reached. Files will not be downloaded : " & now
end if

'Wait 1 minute for new connection attempt
WScript.sleep 60000


objFile.Write "Succesfully Connected and logged in to FTP Server" & vbCrLf

success = ftp.DownloadTree("E**FTP_Data") If (success <> 1) Then objFile.Write ftp.LastErrorText & " : " & Now & vbCrLf objFile.Close WScript.Quit End If


objFile.Write "File(s) Downloaded : " & NOW & vbCrLf objFile.Close

The error file is -

Connecting to FTP Server : 06/06/2014 10:41:57

Succesfully Connected and logged in to FTP Server

File(s) Downloaded : 06/06/2014 10:42:13


I would recommend two general strategies that apply to almost all cases for debugging:

  1. Simplify so that you have an easier problem to solve.
  2. Examine what sources of debugging information exist, and then get that information so that you can determine what questions to ask next.

For #1 -- You are currently calling DownloadTree, an one of the files in particular is the problem. Instead of calling DownloadTree, check to see if the same problem exists by calling GetFile. If so, then debugging the call to GetFile is simpler and more straightforward.

For #2 -- Examine the properties and methods of the Chilkat object to see what sources of debugging information might be available. This advice applies to any object: Http, Imap, MailMan, etc. For Ftp2 you'll find the LastErrorText, which may be verbose by setting the VerboseLogging property = true, and there is also a SessionLog property, which is only kept if the KeepSessionLog property = true. Examine the contents of these properties for the GetFile call (assuming it fails) to see what transpired..


The issue still occurs, I changed the code as requested -

success = ftp.GetFile(".csv","E:***test.csv") objFile.Write ftp.LastErrorText

the Last error text is -

    DllDate: Dec 12 2012
    UnlockPrefix: MRMFIEFTP
    Username: ######
    Architecture: Little Endian; 64-bit
    Language: ActiveX / x64
    VerboseLogging: 0
      enabled: yes
      heartbeatMs: 0
      sendBufferSize: 65536
    AutoGetSizeForProgress: 0
    localFilename: E:\######\test.csv
    Replacing existing local file
        ModeZ: 0
        BinaryMode: 1
        Passive transfer mode
          hostAddr: ####
            hostname: ####
            port: 4439
            ConnectTimeoutMs_1: 60000
            calling ConnectSocket2
            IPV6 enabled connect with NO heartbeat.
            This is an IPV4 numeric address...
                ai_flags: 4
                ai_family: 2
                ai_socktype: 1
                ai_protocol: 0
                ai_addrlen: 16
                ai_canonname: (NULL)
            Connect using IPV4.
            ipAddress1: #######
            myIP_3: #######
            myPort_3: 64978
            connect successful (2)
              SO_SNDBUF: 8192
              SO_RCVBUF: 8192
              TCP_NODELAY: 8192
        PassiveDataConnectionSetupTimeMs: Elapsed time: 203 millisec
        RetrFilename: [Customer.csv]
        RETR_reply: 125 Downloading in BINARY file Customer.csv (32633)
        expectedSize: 32633
        DownloadRate: 72836
        TotalNumBytesReceived: 30664
        ReceiveTimeMs: Elapsed time: 421 millisec
        Data connection closed.
        statusCode3: 226
        finalReply: 226 Transfer completed
        ReadFinalReplyTimeMs: Elapsed time: 0 millisec
      mdtm: 20140606104138
    TotalTimeMs: Elapsed time: 827 millisec
File(s) Downloaded : 06/06/2014 15:41:22


Can you clarify (post a link) where I can download the latest version.