Archived Forum Post

Index of archived forum posts

Question:

FTP NumFilesAndDirs Fails

Jun 20 '12 at 18:07

The FTP site that I am connecting to is causing an error with .NumFilesAndDirs. Is there are way to use LIST instead?

Thanks, - Erik

ChilkatLog:
  NumFilesAndDirs:
    DllDate: Jan 19 2012
    UnlockPrefix: SINSVISFTP
    Username: MATHIS:erik
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    MLSD is only used for full directory listings.  Using LIST instead...
    initialGreeting: 220 xxxxxxxxxxxxxx Public FTP Server
    ListDir:
      No socket exists for sending (2b)
      Failed to send TLS message.
      Failed to send PBSZ command
    --ListDir
    N: -1
    Failed.
  --NumFilesAndDirs
--ChilkatLog

Answer

The "No socket exists for sending" message indicates that in some prior Chilkat method call, the connection to the FTP server was lost. It must be that a previous method call returned a failed status that was not checked. The application continued onward making a call to a Chilkat method/property that requires a command to be sent to the FTP server, but there is no valid connection (i.e. no socket exists).

The same error would occur if the application had never connected in the first place, but I can see that it did because of the "initialGreeting" in the LastErrorText.

It could also be that your application explicitly called the Disconnect method prior to this call.

The first step is to review your application code and make sure that each call to an FTP2 method checks the return value for success/failure and reports the LastErrorText on failure.