Question:
I am testing an application that uses FTP2 to get a file. I am using VB.NET via VS2013 and ChilkatDotNet45.dll version 9.5.0.16. 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:
GetFile: 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 0000Socket 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: mdtm: 20150402165103 TotalTimeMs: Elapsed time: 120000 millisec Success.
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 (9.5.0.48) 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:
GetFile: DllDate: Mar 6 2015 ChilkatVersion: 9.5.0.48 UnlockPrefix: * Username: *** Architecture: Little Endian; 32-bit Language: .NET 4.5 VerboseLogging: 0 ProgressMonitoring: enabled: yes heartbeatMs: 0 sendBufferSize: 65536 --ProgressMonitoring AutoGetSizeForProgress: 0 downloadToFile: localFilename: C:CustomFieldsReceiveToDirectory00000002_20150402090031.CSV downloadToOutput: sendCommand: sendingCommand: TYPE A --sendCommand readCommandResponse: replyLineQP: 200 TYPE set to ASCII --readCommandResponse ModeZ: 0 BinaryMode: 0 setupDataConnection: active transfer mode setupActiveDataSocket: Using ephemeral port range for Active data connection. dataPort: 62435 portIpAddress: 127.0.0.1 MyIPv4: 127,0,0,1,243,227 sendCommand: sendingCommand: PORT 127,0,0,1,243,227 --sendCommand readCommandResponse: replyLineQP: 200 PORT command successful --readCommandResponse --setupActiveDataSocket --setupDataConnection sendCommand: sendingCommand: RETR 00000002_20150402090031.csv --sendCommand completeDataConnection: acceptDataConnection: Data connection accepted. --acceptDataConnection --completeDataConnection readCommandResponse: replyLineQP: 150 Opening ASCII mode data connection for 00000002_20150402090031.csv (903= bytes) --readCommandResponse 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 readCommandResponse: recvUntilMatch: Socket operation timeout. Failed to read FTP control channel reply. readFtpReply: Socket operation timeout. --readCommandResponse No final status reply. --downloadToOutput downloadToOutput: Elapsed time: 60172 millisec --downloadToFile TotalTimeMs: Elapsed time: 60172 millisec Failed.I tried FileZilla and this was fine again.
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.