Hi,
I wrote a little script:to download an ASCII file (4kB) (see below) and I always retrieving an empty file (0kB). With FileZilla I don't have any issues.
Any advises? (Encoding / FTPClient)
Tx
Thomas
DataReadPath="X:\Dokumentation\Energiverbrauch"
Const sFTPServerAddress ="10.111.111.xx"Const sUser ="user"Const sPW ="passwort"Const sDownloadDir ="/usr/sicx/mount/os1/data/cpm/ap/"Const sFuelFile ="TEXTFILE.txt"
Sub btnDownloadFile_EventClick(ByRef This)'Erzeugter Event-HandlerDim conState, dlState conState = ConnectToFTP(sFTPServerAddress, sUser ,sPW)If conState >0Then txtFTPPath.ForeColor =VBGreen txtFTPPath.Text = sDownloadDir & sFuelFile dlState = DownLoadFuelData(conState, sDownloadDir, sFuelFile, DataReadPath)Select Case dlStateCase"FTPNoError" btnLoadFile.Enable =true OK.Enable =trueCallMsgBox("Download completed")Case"FTPError"CallMsgBox("An error occured")Case"FTPTimeout"CallMsgBox("Timeout")Case"FTPAbort"CallMsgBox("Cancel")End SelectElse txtFTPPath.ForeColor =VBRed txtFTPPath.Text ="Could not connect to the server."End IfCallFTPDisconnect(conState)End Sub
Function ConnectToFTP(ipAddress, user, pw)Dim conState conState =FTPConnect(ipAddress, user, pw) ConnectToFTP = conStateEnd Function
Function DownLoadFuelData(oConnectionState, sSourceDir, sFileName, sTargetDir)Dim oDownloadStateIf oConnectionState >0Then'Call MsgBox(sTargetDir & " " & sFileName)Call LogFileWrite("Handle: "& oConnectionState &" SourcePath: "& sSourceDir & sFileName &" TargetDir: "& sTargetDir) oDownloadState =FTPDownload(oConnectionState, sSourceDir, sFileName, sTargetDir)ElseCallMsgBox("Could not connect to the server.")End If DownLoadFuelData = oDownloadStateEnd Function