0 votes
by (360 points)


We are use Rebex FTP library for dot.net: 4.0.6425.0

One of our customers get error message:

Data connection cannot be opened with this PROT setting (521)

I can't find how i can set value for PROT command.

Please, tell me if you need more info.

Applies to: Rebex FTP/SSL

2 Answers

+1 vote
by (70.2k points)
selected by
Best answer

Thank you for the log file. It showed that the error is misleading and is caused by a server side bug very probably.

The error is response to MLST command:

Command: MLST /filename.zip
Response: 521 Data connection cannot be opened with this PROT setting.

However, MLST command does not open Data connection. It provides information about requested file. For details see RFC 3659.

We also use Pure-FTPd server for our tests. Our server is able to handle MLST command successfully. It seems that you have an old version of the server.

The ideal solution is to upgrade your server to the newer version. The MLST command is standard functionality nowadays.

If you cannot upgrade the FTP server, you can try to workaround the issue by disabling MLST on the client. It can be done like this:

var client = new Rebex.Net.Ftp();
client.EnabledExtensions &= ~FtpExtensions.MachineProcessingList;
by (360 points)
Our client answered what can't update FTP on the server, because it's hosting.
We are tryied implement :

    result = new Rebex.Net.Ftp();
    result.EnabledExtensions = FtpExtensions.MachineProcessingList;

but still sending MLST command.

Command MLST sending happens if our code invokes ftp.GetInfo

What can I do more?
by (70.2k points)
No, you did the opposite. You enabled MLST and disabled all other extensions:

  result.EnabledExtensions = FtpExtensions.MachineProcessingList;

I wrote that you have to disable it like this:

  result.EnabledExtensions &= ~FtpExtensions.MachineProcessingList;

The easiest way is to set result.EnabledExtensions = 0; but this will also disable all other features...
by (360 points)
Oh, thank, I'm idiot :-) I saw for the first time this syntaxis for flag attribute and thought it isn't c#.
0 votes
by (70.2k points)

The PROT setting corresponds to Ftp.SecureTransfers property.

We cannot tell you what is wrong from the error message only.
Can you please create communication log as described at https://www.rebex.net/kb/logging/ and post it here or send it to support@rebex.net for analysis?