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

0 votes
asked Aug 16, 2019 by Ivan (360 points)


We are use Rebex FTP library for 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
answered Aug 21, 2019 by Lukas Matyska (59,530 points)
selected Aug 21, 2019 by Ivan
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 /
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;
commented Aug 22, 2019 by Ivan (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?
commented Aug 23, 2019 by Lukas Matyska (59,530 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...
commented Aug 27, 2019 by Ivan (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
answered Aug 19, 2019 by Lukas Matyska (59,530 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 and post it here or send it to for analysis?