Archived Forum Post

Index of archived forum posts


FTP2 GetFile times out when using FreeFTP - any workaround?

Apr 22 '15 at 09:58

I am testing an application that uses FTP2 to get a file. I am using VB.NET via VS2013 and ChilkatDotNet45.dll version I am using FreeFTPd as the server, and it is hosted on localhost. The application opens the ftp site using Connect(), gets the file (GetFile) and closes the connection with Disconnect(). Second time round it never suucceeds at the Connect() stage due to a timeout. This is because the Ftp server seems to be disabled since the first access. The FreeFTPd server instance in services needs to be closed by task manager before it can be started and used successfully again. The problem appears to stem from the initial GetFile, which although successful, generates a LastErrorText of:

    DllDate: Aug  3 2011
    UnlockPrefix: CAPITAFTP
    Username: ERSTHOPE:tyroneh
    Architecture: Little Endian; 64-bit
    Language: .NET 4.0 / x64
    localFilename: C:CustomFieldsReceiveToDirectory00000002_20150402090013.CSV
    ModeZ: 0
    BinaryMode: 0
    Active transfer mode
    Using ephemeral port range for Active data connection.
    bindSockAddr: 0200 0000 0000 0000 0000 0000 0000 0000

Socket bind successful.
dataPort: 61787
MyIP: 127,0,0,1,241,91
SetupDataSocketTimeMS: 0
PortCommandTimeMs: Elapsed time: 0 millisec
RetrFilename: [00000002_20150402090013.csv]
RETR_reply: 150 Opening ASCII mode data connection for 00000002_20150402090013.csv (684 bytes)
expectedSize: 684
AcceptDataConnectionTimeMs: Elapsed time: 0 millisec
DownloadRate: 0
TotalNumBytesReceived: 684
ReceiveTimeMs: Elapsed time: 60000 millisec
Data read timeout.
ReadTimeoutMs: 60000
Timeout waiting to read socket or accept connection
timeoutMs: 60000
Failed to read FTP response line..
ReadFinalReplyTimeMs: Elapsed time: 60000 millisec
  mdtm: 20150402165103
TotalTimeMs: Elapsed time: 120000 millisec

This shows there is a problem waiting for the FTP response. The test file is tiny, and yet the command waits for the full default timeout period before giving up.

The strange thing is that when using FileZilla FTP server, Chilkat is fine, so is FileZilla. I would have written this off as a problem with FreeFTPd software, but I have tried Syncplify FTP server and this shows up the exactly the same behaviour: allows one connect, gets one file, but second and subsequent accesses are impossible without task manager closing the server. My reason for preferring to use FreeFTPd or Syncplify products is because these can be reconfigured to use FTPS and SFTP whereas FileZilla cannot do SFTP.

Are there any settings I need to modify to allow it to function OK with FreeFTPd and Syncplify? Any help will be appreciated.

Kind Regards Tyrone


I don't think you are using the 9.5.x series, because your DLL Date is in 2011. I'd try again with the latest version ( and see if the problem is resolved.

If it persists - are you maintaining the FTP2 object between connections? It shouldn't matter, but you might want to try destroying and recreating the FTP2 object between connections to see if that helps.


Good spot! I thought I was loading the ChilkatDotNet45.dll but had loaded an earlier '4' version. That would not have helped. I will do as you suggest and download the latest dll and hopefully that will sort it out. I will let you know if it doesn't... Cheers Tyrone


I've now got the latest dll. However, as you can see from the following, it has not worked: Failed to process file 00000002_20150402090031.csv - Error: ChilkatLog:

    DllDate: Mar  6 2015
    UnlockPrefix: *
    Username: ***
    Architecture: Little Endian; 32-bit
    Language: .NET 4.5
    VerboseLogging: 0
      enabled: yes
      heartbeatMs: 0
      sendBufferSize: 65536
    AutoGetSizeForProgress: 0
      localFilename: C:CustomFieldsReceiveToDirectory00000002_20150402090031.CSV
          sendingCommand: TYPE A
          replyLineQP: 200 TYPE set to ASCII
        ModeZ: 0
        BinaryMode: 0
          active transfer mode
            Using ephemeral port range for Active data connection.
            dataPort: 62435
            MyIPv4: 127,0,0,1,243,227
              sendingCommand: PORT 127,0,0,1,243,227
              replyLineQP: 200 PORT command successful
          sendingCommand: RETR 00000002_20150402090031.csv
            Data connection accepted.
          replyLineQP: 150 Opening ASCII mode data connection for 00000002_20150402090031.csv (903=
        RETR_reply: 150 Opening ASCII mode data connection for 00000002_20150402090031.csv (903 bytes)
        expectedSize: 903
        downloadRate: 0
        totalNumBytesReceived: 903
        receiveTimeMs: Elapsed time: 0 millisec
          recvUntilMatch: Socket operation timeout.
          Failed to read FTP control channel reply.
          readFtpReply: Socket operation timeout.
        No final status reply.
      downloadToOutput: Elapsed time: 60172 millisec
    TotalTimeMs: Elapsed time: 60172 millisec
I tried FileZilla and this was fine again.
Any ideas would be much appreciated. Kind Regards Ty


How about trying Passive mode instead of Active mode?



I tried active mode and the result was exactly the same. Are there any other ideas? I suspect the problem is in the FTP server software we are trying. Is anyone successfully using FreeFTPd or Syncplify ? Are there any products that do work OK with Chilkat and have the capability of working in FTP, FTPS and SFTP mode? Kind Regards Tyrone


When FileZilla installs, I believe it will typically add an exception to the Windows firewall to allow the FileZilla application through. Your "unknown" application may be blocked. Try adding an exception in Windows Firewall for your application's exe.