Quantcast
Channel: DIAdem topics
Viewing all articles
Browse latest Browse all 3198

FTPDownload DIAdem 2017 FileSize is 0kB w/o FTP Error

$
0
0

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

 


Viewing all articles
Browse latest Browse all 3198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>