Archived Forum Post

Index of archived forum posts


ftp directory listing fails when no files match pattern

Apr 25 '13 at 08:44

If I specify a ListPattern (e.g., ".txt"), NumFilesAndDirs returns -1 if no files match the pattern. If I keep all the same settings but a file matches the pattern, it succeeds. If I set ListPattern to "" it succeeds.

Here is the LastErrorText:

    DllDate: Apr 11 2013
    UnlockPrefix: ****
    Username: ****
    Architecture: Little Endian; 32-bit
    Language: .NET 4.0
    VerboseLogging: 0
    FTP directory cache not fresh.  Fetching dir listing...
      supportsMLSD: 0
      MLSD is only used for full directory listings.  Using LIST instead...
        Sent PROT P command.
        ProtPResponse: 200 PROT command successful.
        Passive transfer mode
          hostAddr: ****
            hostname: ****
            port: 52574
            ConnectTimeoutMs_1: 30000
            calling ConnectSocket2
            IPV6 enabled connect with NO heartbeat.
            This is an IPV4 numeric address...
                ai_flags: 4
                ai_family: 2
                ai_socktype: 1
                ai_protocol: 0
                ai_addrlen: 16
                ai_canonname: (NULL)
            Connect using IPV4.
            ipAddress1: ****
            myIP_3: ****
            myPort_3: 50873
            connect successful (2)
              SO_SNDBUF: 8192
              SO_RCVBUF: 8192
              TCP_NODELAY: 8192
          sendingCommand: LIST *.dat
        Failed to convert listDir data socket to TLS
    N: -1


In the FTP protocol, directory listings are transferred on a separate data channel just like file download and uploads. It must be that for this FTP server, when no files match the pattern, that it entirely skips the establishment of the data channel (which is why you see the error listed as "Failed to convert listDir data socket to TLS")

I'll investigate. If I cannot reproduce the problem, it's likely because the FTP servers I have for testing don't behave in this way. In that case, I'll try to make a change that should work, and then you can test it. (The new build may take a day or so because of other work in progress..)

I'll post here when the new build is ready.