Archived Forum Post

Index of archived forum posts

Question:

FTP Data Connection Fails: SocketError: WSAEWOULDBLOCK The socket would block.

Jun 29 '12 at 12:04

When using the older version I am able to get a directory listing. But when I am using the new version I am not able to get the directory listing. I changed the time out value but no luck with that either. I am connecting to the same server with the same parameters. Here is the error message for the new 9.3.1 version.

ChilkatLog:
  NumFilesAndDirs:
    DllDate: Jun  4 2012
    UnlockPrefix: *
    Username: 
    Architecture: Little Endian; 32-bit
    Language: .NET 2.0
    FTP directory cache not fresh.  Fetching dir listing...
    checkDirCache_listPattern:
      supportsMLSD: 0
      MLSD is only used for full directory listings.  Using LIST instead...
      ListDir:
        Passive transfer mode
        EPSV_reply: 229 ENTERING EXTENDED PASSIVE MODE (|||*|)
        hostAddr: 
        DataConnect:
          hostname: *
          port: 
          ConnectTimeoutMs_1: 60000
          calling ConnectSocket2
          IPV6 enabled connect with NO heartbeat.
          This is an IPV4 numeric address...
          AddrInfoList:
            AddrInfo:
              ai_flags: 4
              ai_family: 2
              ai_socktype: 1
              ai_protocol: 0
              ai_addrlen: 16
              ai_canonname: (NULL)
            --AddrInfo
          --AddrInfoList
          Connect using IPV4.
          ipAddress1: ***
          timeout waiting for connect to complete
          numSec: 15
          numMicroSec: 532000
          Connect function failed..
          SocketError: WSAEWOULDBLOCK The socket would block.
          For more information see this Chilkat Blog post: http://www.cknotes.com/?p=210
        --DataConnect
        Failed to setup passive data socket for LIST.
     --ListDir
    --checkDirCache_listPattern
    N: -1
    Failed.
  --NumFilesAndDirs
--ChilkatLog


Answer

Whenever a data connection fails because of a timeout, it's because of a firewall blocking the connection. It could be a firewall on the client-side and/or server-side. The typical solution is: If using passive mode, then switch to active (non-passive) mode by setting the ftp.Passive property = false. If using active mode, then switch to passive mode. To understand passive/active modes for FTP, see this: FTP Passive and Active Modes Explained.

The default mode for Chilkat FTP2 was changed from active to passive in v9.3.1. The reason is that it's more common for passive to be the non-blocked FTP mode vs. active.

If setting the Passive property to the opposite value does not solve the problem, see this Chilkat blog post about additional settings: Determining FTP2 Connection Settings