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 -
The point where it cuts off is -
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?
asked Jun 06 '14 at 06:00
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"?
answered Jun 06 '14 at 08:54
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()
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:
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..
answered Jun 06 '14 at 10:15
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 -
ChilkatLog: GetFile: DllDate: Dec 12 2012 UnlockPrefix: MRMFIEFTP Username: ###### Architecture: Little Endian; 64-bit Language: ActiveX / x64 VerboseLogging: 0 ProgressMonitoring: enabled: yes heartbeatMs: 0 sendBufferSize: 65536 --ProgressMonitoring AutoGetSizeForProgress: 0 localFilename: E:\######\test.csv Replacing existing local file GetFileToOutput_1: getFileToOutput2_1: ModeZ: 0 BinaryMode: 1 Passive transfer mode setupPassiveDataSocket2: hostAddr: #### DataConnect: hostname: #### port: 4439 ConnectTimeoutMs_1: 60000 calling ConnectSocket2 IPV6 enabled connect with NO heartbeat. This is an IPV4 numeric address... AddrInfoList: AddrInfo: ai_flags: 4 ai_family: 2 ai_socktype: 1 ai_protocol: 0 ai_addrlen: 16 ai_canonname: (NULL) --AddrInfo --AddrInfoList Connect using IPV4. ipAddress1: ####### myIP_3: ####### myPort_3: 64978 connect successful (2) socketOptions: SO_SNDBUF: 8192 SO_RCVBUF: 8192 TCP_NODELAY: 8192 --socketOptions --DataConnect --setupPassiveDataSocket2 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 --getFileToOutput2_1 --GetFileToOutput_1 Mdtm: mdtm: 20140606104138 --Mdtm TotalTimeMs: Elapsed time: 827 millisec Success. --GetFile --ChilkatLog File(s) Downloaded : 06/06/2014 15:41:22
Can you clarify (post a link) where I can download the latest version.
answered Jun 06 '14 at 11:03