Archived Forum Post

Index of archived forum posts

Question:

Ftp2 library: Connect to a default remote directory.

Jan 21 '14 at 09:08

I'm trying to connect to an FTP server, but the Connect method fails with reason 200 (Connected, but failed to receive greeting from FTP server). After that the client is disconnected (IsConnected = false) and I cannot issue any commands.

For the same server, using FileZilla, I have to set the "Default Remote Directory" to a provided value and it works (otherwise it also fails).

How can I achieve connecting to a default directory, using the Chilkat library? In my case I cannot issue a CWD command, because the client needs to be connected.

Follows the log from Chilkat library (replaced sensitive information with *):

  Connect_Ftp2:
    DllDate: Aug 15 2013
    ChilkatVersion: 9.4.1.42
    UnlockPrefix: Test
    Username: ***
    Architecture: Little Endian; 32-bit
    Language: .NET 4.0
    VerboseLogging: 1
    ProgressMonitoring:
      enabled: yes
      heartbeatMs: 0
      sendBufferSize: 65536
    --ProgressMonitoring
    ImplicitSsl: 0
    AuthTls: 0
    AuthSsl: 0
    Hostname: ***
    Port: 21
    IdleTimeoutMs: 15000
    ConnectTimeout: 15
    ConnectTimeoutMs_1: 15000
    calling ConnectSocket2
    IPV6 enabled connect with NO heartbeat.
    connectingTo: ***
    resolveHostname1:
      Resolving domain name (IPV4) via gethostbyname
    --resolveHostname1
    GetHostByNameHB_ipv4: Elapsed time: 312 millisec
    myIP_1: ***
    myPort_1: 52338
    connect successful (1)
    Turning on TCP_NODELAY.
    socketOptions:
      SO_SNDBUF: 8192
      SO_RCVBUF: 8192
      TCP_NODELAY: 1
    --socketOptions
    readFtpControlChannelReply:
      rcvUntilMatchStringQP: =0A
      dbReceived0: 
      Timeout waiting to read socket or accept connection
      timeoutMs: 15000
      recvUntilMatch: Socket timeout.
      Failed to read FTP response line..
    --readFtpControlChannelReply
    initialStatus: -1
    initialResponse: 
    Failed to connect to FTP server.
    Failed.
  --Connect_Ftp2
--ChilkatLog

Answer

Eventually it was as simple as increasing the IdleTimeoutMs from 15000 to 60000. Spend 3 hours on this. I feel so stupid!