Archived Forum Post

Index of archived forum posts

Question:

GetRemoteFileBinaryData returns 0 file content length

May 05 '17 at 10:30

Hi, I have a .NET batch process that retrieves PDF files from ftp. I'm using ChilkatDotNet2 (FTP2) version 9.5.0.66. This doesn't happen all the time but once in a while the method GetRemoteFileBinaryData returns a file content length of 0. However the PDF clearly is not empty. I've basically been stopping and rerunning the process and suddenly it will work again. Anyone experience this same issue?

Dim FileContent As Byte() FileContent = Ftp.GetRemoteFileBinaryData(fileName)


Answer

Look at the contents of the Ftp.LastErrorText property.

Whenever a Chilkat method fails or doesn't behave as expected, look at the contents of the LastErrorText property. The LastErrorText always contains information for the last method call, even if successful. You can turn on verbose logging by setting the Ftp.VerboseLogging property = true (or 1, or whatever applies in the given programming language)


Answer

This is what came back in the last error text

 
ChilkatLog:
  GetRemoteFileBinaryData:
    DllDate: Mar 20 2017
    ChilkatVersion: 9.5.0.66
    UnlockPrefix: MDCEDUFTP
    Architecture: Little Endian; 32-bit
    Language: .NET 2.0
    VerboseLogging: 0
    ProgressMonitoring:
      enabled: yes
      heartbeatMs: 0
      sendBufferSize: 65536
    --ProgressMonitoring
    downloadToMemory:
      downloadToOutput:
        modeZ: 0
        binaryMode: 1
        pbsz_protp:
          simpleCommand:
            sendCommand:
              sendingCommand: PBSZ 0
            --sendCommand
            readCommandResponse:
              processAlert:
                TlsAlert:
                  level: fatal
                  descrip: bad record mac
                --TlsAlert
                Closing connection in response to fatal SSL/TLS alert.
              --processAlert
              Failed to receive more bytes.
              Failed to read FTP control channel reply.
            --readCommandResponse
          --simpleCommand
        --pbsz_protp
      --downloadToOutput
    --downloadToMemory
    Failed.
  --GetRemoteFileBinaryData
--ChilkatLog


Answer

Please try this new build:
https://chilkatdownload.com/prerelease/chilkatdotnet2-9.5.0-win32-108.zip
https://chilkatdownload.com/prerelease/chilkatdotnet2-9.5.0-x64-109.zip


Answer

Thanks for your quick reply. I tried with the new build but received similar error.

ChilkatLog:
  GetRemoteFileBinaryData:
    DllDate: May  4 2017
    ChilkatVersion: 9.5.0.67
    UnlockPrefix: MDCEDUFTP
    Architecture: Little Endian; 32-bit
    Language: .NET 2.0
    VerboseLogging: 0
    downloadToOutput:
      ProgressMonitoring:
        enabled: yes
        heartbeatMs: 0
        sendBufferSize: 65536
      --ProgressMonitoring
      downloadToOutput:
        downloadToOutput2:
          modeZ: 0
          binaryMode: 1
          pbsz_protp:
            simpleCommand:
              sendCommand:
                sendingCommand: PBSZ 0
              --sendCommand
              readCommandResponse:
                replyLineQP: 200 PBSZ set to 0.
              --readCommandResponse
            --simpleCommand
            simpleCommand:
              sendCommand:
                sendingCommand: PROT P
              --sendCommand
              readCommandResponse:
                replyLineQP: 200 PROT now Private.
              --readCommandResponse
            --simpleCommand
          --pbsz_protp
          setupDataConnection:
            passive transfer mode
            setupPassiveDataSocket:
              sendCommand:
                sendingCommand: PASV
              --sendCommand
              readCommandResponse:
                replyLineQP: 227 Entering Passive Mode (23,246,200,139,46,247).
              --readCommandResponse
              dataConnect:
                hostname: 23.246.200.139
                port: 12023
                socketOptions:
                  SO_SNDBUF: 262144
                  SO_RCVBUF: 4194304
                  TCP_NODELAY: 0
                  SO_KEEPALIVE: 0
                --socketOptions
                dataConnectSuccess: 1
              --dataConnect
            --setupPassiveDataSocket
          --setupDataConnection
          sendCommand:
            sendingCommand: RETR IBR_2918897.pdf
          --sendCommand
          readCommandResponse:
            processAlert:
              TlsAlert:
                level: fatal
                descrip: bad record mac
              --TlsAlert
              Closing connection in response to fatal SSL/TLS alert.
            --processAlert
            Failed to receive more bytes.
            Failed to read FTP control channel reply.
          --readCommandResponse
          Failed to read RETR intermediate reply
        --downloadToOutput2
      --downloadToOutput
    --downloadToOutput
    Failed.
  --GetRemoteFileBinaryData
--ChilkatLog

Answer

I think the only way to investigate is to test directly with that particular server. If you're licensed and wish to provide a test account, please send email to support@chilkatsoft.com