Archived Forum Post

Index of archived forum posts

Question:

Ftp2 ActiveX GET downloads zero length files

Dec 14 '16 at 00:21

Hi,

Downloaded files from one of our operators are always empty. I have tried active/passive modes, GET/MGET, ascii or binary to no avail. What is curios is that I can download the files from command prompt!

Currently I use ChilkatAx-9.5.0-win32.dll version 9.5.0.64.

Has anybody else had the same problem?

Thanks,

Dan

Here is a part of the dump file created (older dll):

MGetFiles:
    DllDate: Mar 11 2016
    ChilkatVersion: 9.5.0.56
    UnlockPrefix: xxxxxxxx
    Username: DCEPROSPED01:xxxxx
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 1
    ProgressMonitoring:
        enabled: yes
        heartbeatMs: 0
        sendBufferSize: 65536
        (leaveContext)
    pattern: *.*
    localDir: D:\Digia\Ajastetut_Test\DigiaFTP2\TEMP\
    fetchDirListing:
        fetchDirListing2:
            setupDataConnection:
                setupPassiveDataSocket:
                    sendCommand:
                        prepControlChannel:
                            (leaveContext)
                        sendingCommand: PASV
                        (leaveContext)
                    readCommandResponse:
                        replyLineQP: 227 Entering Passive Mode (82,199,234,18,216,2)
                        (leaveContext 63ms)
                    dataConnect:
                        hostname: 82.199.234.18
                        port: 55298
                        socket2Connect:
                            connect2:
                                hostname: 82.199.234.18
                                port: 55298
                                ssl: 0
                                connectSocket:
                                    domainOrIpAddress: 82.199.234.18
                                    port: 55298
                                    connectTimeoutMs: 30000
                                    connect_ipv6_or_ipv4:
                                        This is an IPV4 numeric address.
                                        Domain to IP address resolution not needed.
                                        getAddressInfo:
                                            (leaveContext)
                                        connecting to IPV4 address...
                                        ipAddress: 82.199.234.18
                                        createSocket:
                                            Setting SO_SNDBUF size
                                            sendBufSize: 262144
                                            Setting SO_RCVBUF size
                                            recvBufSize: 4194304
                                            (leaveContext 15ms)
                                        connect:
                                            Waiting for the connect to complete...
                                            ck_getsockname_ipv4:
                                                (leaveContext)
                                            myIP: 10.61.208.110
                                            myPort: 54423
                                            socket connect successful.
                                            (leaveContext 63ms)
                                        (leaveContext 78ms)
                                    (leaveContext 78ms)
                                (leaveContext 78ms)
                            (leaveContext 93ms)
                        socketOptions:
                            SO_SNDBUF: 262144
                            SO_RCVBUF: 4194304
                            TCP_NODELAY: 0
                            SO_KEEPALIVE: 0
                            (leaveContext)
                        dataConnectSuccess: 1
                        (leaveContext 93ms)
                    (leaveContext 156ms)
                (leaveContext 156ms)
            sendCommand:
                prepControlChannel:
                    (leaveContext)
                sendingCommand: LIST
                (leaveContext)
            readCommandResponse:
                replyLineQP: 150 Binary data connection for  (10.231.32.220,21558) (0 bytes).
                (leaveContext 63ms)
            readFtpDataChannel:
                numBytesRequested: 4096
                Connection closed by peer.
                passiveClose:
                    Passive socket closing complete.
                    (leaveContext)
                dirListSize: 115
                (leaveContext)
            rawListingQP:   00000398   2       6024  29.11 2016 15.22.39  testi-0398=0Ad        0  28=

          0  28.11 2008 14.24.09  valmiit=0A
            CWAY directory listing
            CWAY directory listing
            readCommandResponse:
                replyLineQP: 226 Binary Transfer complete.
                (leaveContext)
            ListTimeMS: 234
            (leaveContext 234ms)
        (leaveContext 234ms)
    fileCount: 1
    totalByteCount: 6024
    filename: testi-0398
    downloadToFile:
        localFilename: D:\Digia\Ajastetut_Test\DigiaFTP2\TEMP\testi-0398
        openForReadWriteWin32:
            (leaveContext)
        downloadToOutput:
            ensureCorrectMode:
                simpleCommand:
                    sendCommand:
                        prepControlChannel:
                            (leaveContext)
                        sendingCommand: TYPE A
                        (leaveContext)
                    readCommandResponse:
                        replyLineQP: 200 Type set to A.
                        commandResponse: 200 Type set to A.
                        statusCode: 200
                        (leaveContext 63ms)
                    (leaveContext 63ms)
                (leaveContext 63ms)
            setupDataConnection:
                setupPassiveDataSocket:
                    sendCommand:
                        prepControlChannel:
                            (leaveContext)
                        sendingCommand: PASV
                        (leaveContext)
                    readCommandResponse:
                        replyLineQP: 227 Entering Passive Mode (82,199,234,18,216,5)
                        (leaveContext 63ms)
                    dataConnect:
                        hostname: 82.199.234.18
                        port: 55301
                        socket2Connect:
                            connect2:
                                hostname: 82.199.234.18
                                port: 55301
                                ssl: 0
                                connectSocket:
                                    domainOrIpAddress: 82.199.234.18
                                    port: 55301
                                    connectTimeoutMs: 30000
                                    connect_ipv6_or_ipv4:
                                        This is an IPV4 numeric address.
                                        Domain to IP address resolution not needed.
                                        getAddressInfo:
                                            (leaveContext)
                                        connecting to IPV4 address...
                                        ipAddress: 82.199.234.18
                                        createSocket:
                                            Setting SO_SNDBUF size
                                            sendBufSize: 262144
                                            Setting SO_RCVBUF size
                                            recvBufSize: 4194304
                                            (leaveContext)
                                        connect:
                                            Waiting for the connect to complete...
                                            ck_getsockname_ipv4:
                                                (leaveContext)
                                            myIP: 10.61.208.110
                                            myPort: 54425
                                            socket connect successful.
                                            (leaveContext 78ms)
                                        (leaveContext 78ms)
                                    (leaveContext 78ms)
                                (leaveContext 78ms)
                            (leaveContext 78ms)
                        socketOptions:
                            SO_SNDBUF: 262144
                            SO_RCVBUF: 4194304
                            TCP_NODELAY: 0
                            SO_KEEPALIVE: 0
                            (leaveContext)
                        dataConnectSuccess: 1
                        (leaveContext 78ms)
                    (leaveContext 156ms)
                (leaveContext 156ms)
        sendCommand:
            prepControlChannel:
                (leaveContext)
            sendingCommand: RETR testi-0398
            (leaveContext)
        readCommandResponse:
            replyLineQP: 150 ASCII data connection for testi-0398 (10.231.32.220,63602) (0 bytes).
            (leaveContext 62ms)
        RETR_reply: 150 ASCII data connection for testi-0398 (10.231.32.220,63602) (0 bytes).
        expectedSize64_2: 0
        This file is known to be 0 bytes in length.
        ftpServerGreeting: 220 edibasic-cway1 FTP server (CWAY Ver 1.0, UNIX(r) SVR4.0) ready.
        ftpServerSyst: UNIX Cway
        readCommandResponse:
            replyLineQP: 226 ASCII Transfer complete.
            (leaveContext)
        (leaveContext 343ms)
    downloadToOutput: Elapsed time: 359 millisec
    MDTM is not supported by this FTP server.
    Cannot maintain the last-modified date/time automatically.
    (leaveContext 359ms)
elapsedTimeInSeconds: 0
(leaveContext 608ms)

Accepted Answer

This new pre-release now fixes the problem:

http://chilkatdownload.com/prerelease/chilkatax-9.5.0-win32.zip


Answer

Try this new build:

32-bit Download: http://chilkatdownload.com/prerelease/chilkatax-9.5.0-win32.zip
64-bit Download: http://chilkatdownload.com/prerelease/chilkatax-9.5.0-x64.zip

Also, set the ftp.AutoGetSizeForProgress property = 1 to force the Ftp2 object to get the file size prior to downloading.

This FTP server seems to be a liar. ;) It's responding with this message:

RETR_reply: 150 ASCII data connection for testi-0398 (10.231.32.220,63602) (0 bytes).

Chilkat sees the "(0 bytes)" in the reply and believes it. Setting the AutoGetSizeForProgress, in conjunction with using the new build, should make Chilkat ignore the "(0 bytes)" response.