Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4k views
in .NET FTP by (740 points)
Hi Robert

Can you FTP into the machine from the command-line, navigate to your directory you want to list, type 'debug' and then 'dir'.

Then send us the output of the listing. We'll take a look and try to find a solution.

Regards

Bruce Blackshaw
EDT

-----Original Message-----
Sent: 30 January 2007 03:00
To: support@enterprisedt.com
Subject: edtFTPnet - ParseProblem

Hallo,

I couldn't register into your forum. Anyway I do have the following problem:

I am using your free 1.2.3 .net Version. And have the ftp server running on UNIX Type: L8 Version: SUNOS

When I try running the following code:

FTPFile[] files = ftpConnection.GetFileInfos();

this exception is thrown:

Unexpected number of fields in listing 'dev:' - expected minimum 8 fields but found 1 fields

So I guess, that the parser doesn't work right. So I tried writing my own ParserClass. The parse method of this parser gets "total 394" as a string. So there is not much information to parse.

What can I do?

I connect to several machines in the network with the same OS. I can connect to some machines and list files.

Many regards,
Robert.

6 Answers

0 votes
by (740 points)
Hi,

I couldn't ftp into the machine via command-line while having Windows 2000 as Client. I tried using telnet. I will try again by tomorrow.

But as I found your source and had a play with it, it seems that when I log into the machines which cause the exception and ask for the LIST, it recursively polls out all directories and files from the server?
On the machines where I don't get the exception, it just polls out the 1st level file list.

(It took me a while to turn on your logger in edtFTPnet. As the config.xml file said, it's turned on, it didn't log. A second config line should let the user set up a log target like log to file or to trace, etc.)

Regards,
Robert.
0 votes
by (162k points)
Yes, there are some unusual servers that try to recursively list a directory when LIST is called. We don't support them.

You could try using Dir(false) instead, which sends the NLST command and gets a list of strings (filenames).
0 votes
by (740 points)
Hi,

using NLST means having only the filenames of the FTP listing. But I want all the details of the file.

I fixed my problem. I suggest changing your code in this function in FTPConnection.cs:

      public virtual FTPFile[] GetFileInfos()
      {
         lock (activeClient)
         {
            return activeClient.DirDetails(".");
         }
      }


to

      public virtual FTPFile[] GetFileInfos()
      {
         lock (activeClient)
         {
            return activeClient.DirDetails(this.ftpClient.Pwd());
         }
      }


It worked well on the machines I have to work with (10 of it, two different setups).

This method also needs changes:


public virtual string[] GetFiles()
      {            
         return GetFiles(".");
      }


Thanx for your lib it is so helpful, it will be part of my diploma thesis,
Robert.
0 votes
by (162k points)
So on your servers does using "." do a recursive listing (using LIST) and using the full name via pwd not do this?

What happens if you do GetFileInfos("")?

thanks
0 votes
by (740 points)
So on your servers does using "." do a recursive listing (using LIST) and using the full name via pwd not do this?


Yes, some of it do with "." the recursive listing (using LIST).

What happens if you do GetFileInfos("")?


It worked as accepted on all machines. Why do you use "." instead?

Regards,
Robert.
0 votes
by (162k points)
We use "." because with rare exceptions (like yours it seems) it works for most servers. However we'll consider changing it to nothing if that works better.

Categories

...