Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
6.2k views
in .NET FTP by
I'm trying to get a list of files on the remote server. I call FtpClient.Dir() and in turn, the FtpClient issues an NLST.

The server returns the following error: Can't open data connection.

If I open an ftp connection through a command line, NLST (or LIST) won't work either (bad command). LS or DIR work, though. Based on that, I've tried modifying the ftpClient.Dir() method to use LS and DIR, but that doesn't work either.

Any ideas?

Thanks,
Richard

1 Answer

0 votes
by (158k points)
It could be that the commandline client is using active mode and you are passive mode - try active mode. There's an API call to set it.

From the command line you can see the actual FTP commands by typing 'debug' - you'll see that LS and DIR aren't actual FTP commands.

You'll also see if the client is using active mode - a 'PORT' command will be seen.

I'm trying to get a list of files on the remote server. I call FtpClient.Dir() and in turn, the FtpClient issues an NLST.

The server returns the following error: Can't open data connection.

If I open an ftp connection through a command line, NLST (or LIST) won't work either (bad command). LS or DIR work, though. Based on that, I've tried modifying the ftpClient.Dir() method to use LS and DIR, but that doesn't work either.

Any ideas?

Thanks,
Richard

Categories

...