Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
5.4k views
in .NET FTP by (280 points)
Hi,

I currently using the free version of your library to connect to a microcontroller with integrated FTP server function, the internal FTP server is very limited and certain commands are not available. My problem is that I can't use the GetFiles() command, I get an error "code=504" command not implemented.

here's the log :
DEBUG [EnterpriseDT.Net.HostNameResolver] 27 oct. 2006 15:28:14.143 : 172.20.0.252 resolved to 172.20.0.252
DEBUG [EnterpriseDT.Net.Ftp.FTPClient] 27 oct. 2006 15:28:14.174 : Connecting to 172.20.0.252:21
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 27 oct. 2006 15:28:14.206 : 220 Hello! Welcome to Pragtec FTP Server!
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 27 oct. 2006 15:28:14.206 : ---> USER foo
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 27 oct. 2006 15:28:14.206 : 331 Password required
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 27 oct. 2006 15:28:14.206 : ---> PASS ********
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 27 oct. 2006 15:28:14.221 : 230 User logged in.
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 27 oct. 2006 15:28:14.221 : ---> TYPE I
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 27 oct. 2006 15:28:14.221 : 200 IMAGE mode set
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 27 oct. 2006 15:28:16.100 : ---> CWD /fs2
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 27 oct. 2006 15:28:16.100 : 250 OK
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 27 oct. 2006 15:28:16.476 : ---> PASV
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 27 oct. 2006 15:28:16.491 : 227 Entering Passive Mode (172,20,0,252,4,28).
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 27 oct. 2006 15:28:16.491 : Substituting server supplied IP (172.20.0.252) with remote host IP (172.20.0.252)
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 27 oct. 2006 15:28:16.491 : ---> NLST .
DEBUG [EnterpriseDT.Net.Ftp.FTPControlSocket] 27 oct. 2006 15:28:16.507 : 504 Command not implemented for that parameter.


Anybody knows what I could do ?

I can use that FTP server fine when using Filezilla.

Thanks!

8 Answers

0 votes
by (51.6k points)
Try using GetFileInfos().

- Hans (EDT)
0 votes
by (280 points)
I'm able to connect with :
        Dim list() As String

        Dim FTPClient = New FTPClient

        With FTPClient
            .RemoteHost = "172.20.0.252"
            .connect()
            .user = "foo"
            .password = "bar"
            .chdir("/fs2")
            .transfertype = EnterpriseDT.Net.Ftp.FTPTransferType.BINARY
            '.Get("c:\test.txt", "file1")
            list = .dir()
            .quit()
        End With


is that good ?

How can I declare FTPClient so VB can auto-complete and show available properties ?

GetFileInfos() gives me the same error.

Thanks for your help!
0 votes
by (162k points)
If GetFileInfos() gives you the same error, you are out of luck. Your minimal FTP server doesn't support the necessary commands.
0 votes
by (280 points)
well it works with the code I posted above.
0 votes
by (162k points)
What I mean is that it looks like you won't be able to use GetFileInfos() or GetFiles() to get directory listings.

Transferring files should work fine.
0 votes
by (280 points)
true but I can get the directory listing with FTPClient.Dir().
0 votes
by (51.6k points)
This is quite strange since FTPConnection.GetFiles() actually calls FTPClient.Dir() as shown here:
public virtual string[] GetFiles(string directory)
{
   lock (ActiveClient)
   {
      string[] files = ActiveClient.Dir(directory, false);
      if (files.Length==0 && LastValidReply.ReplyText.ToLower().IndexOf("permission")>=0)
      {
         FTPFile[] ftpFiles = GetFileInfos(directory);
         files = new string[ftpFiles.Length];
         for (int i=0; i<ftpFiles.Length; i++)
            files[i] = ftpFiles[i].Name;
      }
      return files;
   }
}

ActiveClient is an instance of FTPClient in your case.

Would you mind compiling the edtFTPnet source into your application, putting a breakpoint in the above method and stepping through to see what goes wrong.

- Hans (EDT)
0 votes
by (280 points)
I used the source but I'm having a hard time pin pointing the error but if I change that line

string[] files = ActiveClient.Dir(directory, false);


for

string[] files = ActiveClient.Dir();


it works...if you need me to do more tests, just ask I'm always glad to help.

Categories

...