Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.5k views
in .NET FTP by (160 points)
Hi, I'm evaluating your product so I downloaded edtFTPnet/Free 1.3.0 and I'm trying it with a non-standard FTP server that I have to face with.
I accepts custom commands and return custom results.
I was able to send custom commands using InvokeFTPCommand successfully but when I have to read data from a LIST command I've some problem. First of all FTPConnection does not have an InvokeDataCommand so a custom command that use a data connection seems to be impossible to be sent.
As LIST is a standard command (also if the server returns a non standard output) I tried with FTPClient, both with Active and Passive mode but it always return an empty list.
Looking at the log I see

DEBUG [FTPControlSocket] 28 nov 2008 17.21.18.578 : ---> USER root
DEBUG [FTPControlSocket] 28 nov 2008 17.21.18.578 : 230 User root logged in.
DEBUG [FTPControlSocket] 28 nov 2008 17.21.27.953 : ---> PASV
DEBUG [FTPControlSocket] 28 nov 2008 17.21.27.953 : 227 Entering passive mode (172,16,0,20,18,132)
DEBUG [FTPControlSocket] 28 nov 2008 17.21.27.953 : Server supplied address=172.16.0.20
DEBUG [FTPControlSocket] 28 nov 2008 17.21.27.953 : Server supplied port=4740
DEBUG [FTPControlSocket] 28 nov 2008 17.21.27.953 : NewPassiveDataSocket(172.16.0.20,4740)
DEBUG [FTPControlSocket] 28 nov 2008 17.21.27.953 : ---> LIST testdir
DEBUG [FTPControlSocket] 28 nov 2008 17.21.27.953 : 150 Opening new data connection for "testdir".
DEBUG [FTPClient] 28 nov 2008 17.21.27.968 : Reading ASCII listing data
DEBUG [FTPControlSocket] 28 nov 2008 17.21.28.125 : 226 Transfer complete.
DEBUG [FTPClient] 28 nov 2008 17.21.28.125 : No listing data found


or

DEBUG [FTPControlSocket] 28 nov 2008 17.17.36.843 : ---> USER root
DEBUG [FTPControlSocket] 28 nov 2008 17.17.36.843 : 230 User root logged in.
DEBUG [FTPControlSocket] 28 nov 2008 17.17.44.828 : NewActiveDataSocket(0)
DEBUG [FTPControlSocket] 28 nov 2008 17.17.44.828 : ---> PORT 172,16,3,50,8,14
DEBUG [FTPControlSocket] 28 nov 2008 17.17.45.125 : 200 PORT command successful.
DEBUG [FTPControlSocket] 28 nov 2008 17.17.45.125 : ---> LIST doneq
DEBUG [FTPControlSocket] 28 nov 2008 17.17.45.125 : 150 Opening new data connection for "doneq".
DEBUG [FTPClient] 28 nov 2008 17.17.45.140 : Reading ASCII listing data
DEBUG [FTPActiveDataSocket] 28 nov 2008 17.17.45.140 : AcceptConnection() succeeded
DEBUG [FTPControlSocket] 28 nov 2008 17.17.45.359 : 226 Transfer complete.
DEBUG [FTPClient] 28 nov 2008 17.17.45.359 : No listing data found


It seems that no result are returned from the server but if I connect with a linux box to the ftp and I launch the same command I see

-> USER root
331 Password required for root.
Password:
-> PASS XXXX
230 User root logged in.
-> PORT 127,0,0,1,212,4
200 PORT command successful.
-> LIST testdir
150 Opening new data connection for "testdir".

XXX  XXX X  XXX XXX  XXXXX
XXX  XXX X  XXX XXX  XXXXX
XXX  XXX X  XXX XXX  XXXXX
XXX  XXX X  XXX XXX  XXXXX
XXX  XXX X  XXX XXX  XXXXX
XXX  XXX X  XXX XXX  XXXXX
(for 250 times)

226 Transfer complete.


So I would like to know:
- If I can send data commands using FTPConnection
- If I'm doing something wrong launchin LIST command.

I give you a piece of my code
_Connection = new EnterpriseDT.Net.Ftp.FTPClient();
_Connection.RemoteHost = serverAddress;
_Connection.ControlPort = serverPort;
_Connection.Connect();
_Connection.Login(userName, password);
string[] response = _Connection.Dir("testdir",true);

3 Answers

0 votes
by (162k points)
Servers can be a bit finicky with LIST.

Try changing into the directory you want to list and use "" as the directory name.
0 votes
by (160 points)
Same results.
It seems that the receiving of the data stream an the 226 code is not in sync, the 226 code is received immediately but the library does not wait for the data stream containing results.
This seems to be confirmed from the fact that issuing the same command on a directory with fewer files it works.
I also noticed that sending the command from a windows box, using the command line ftp, I receive the same result of using the library. I'm confused.
Some hint? Also for the problem of sending custom commands on the same session.
Thanks in advance.
0 votes
by (162k points)
You can't send custom data commands. It would be easy to modify the code for you to do so though.

It's not clear why no listing data is sent, especially since command line FTP gives the same result. Perhaps the server logs hold the answer. It might be that the server won't send the listing if the directory has too many entries I suppose.

Categories

...