Archived Forum Post

Index of archived forum posts


GetFile fails, but file downloaded successfully; wrong expectedByteCount; right downloadedByteCount

Jul 05 '17 at 04:43

I've upgraded my ftp2 activex control at the last version in last days; during my tests in some case I had some GetFile error message that with earlier version I did not have; there were messages like the one following. As you see: 1) Xml report says that "226-File successfully transferred" 2) Xml report says that "<downloadedbytecount>43</downloadedbytecount>" 3) Xml report says that "<expectedbytecount>325985</expectedbytecount>" so it seems that this error is about "<error>Downloaded byte count less than expected byte count.</error>" 4) But if I call Ftp.GetSizeByName, I've exactly the dimension corresponding to "<downloadedbytecount>" Have you ever find siyuation like this? Thank you

        <DllDate>May 25 2017</DllDate>
        <Architecture>Little Endian; 32-bit</Architecture>
        <Language>.NET 4.0</Language>
                    <info>passive transfer mode</info>
                            <replyLineQP>227 Entering Passive Mode (62,149,141,10,191,120)</replyLineQP>
                    <sendingCommand>RETR TypologyGroupList.ARG.BAK</sendingCommand>
                    <replyLineQP>150 Accepted data connection</replyLineQP>
                <receiveTimeMs>Elapsed time: 31 millisec</receiveTimeMs>
                <info>Data connection closed.</info>
                    <replyLineQP>226-File successfully transferred</replyLineQP>
                    <replyLineQP>226 0.000 seconds (measured here), 130.37 Kbytes per second</replyLineQP>
                <error>Downloaded byte count less than expected byte count.</error>
            <downloadToOutput>Elapsed time: 93 millisec</downloadToOutput>


This would happen when the FTP2 component knows the remote file size but receives a different amount of data.

Maybe you have a situation where you previously downloaded a directory listing (either implicitly or explicitly), then something caused the size of the file on the server to change, and then you tried downloading.

You can try two things:

1) Set the ftp2.AutoGetSizeForProgress property = 0. (0 is the default, so this would only apply if you previously set the property = 1)

2) Call the ftp2.ClearDirCache() method before calling GetFile.


Hi, thank you for your reply; I've try your suggested solutions, but unfortunately I had the same messages like before; do you have any kind of other suggestion for this case? Thanks