FTP server in passive mode

Hi all,

has some one an idea, how we can set passive mode and the passive ports for the built in ftp server of windows embedded compact 2013?

We need the passive ftp mode because we have the module behind a nat firewall.

Thank you,

greetings Sam

Dear @SamFoster

The built-in FTP server already supports both active and passive mode FTP.
There is no configuration required - when establishing the connection, the client defines whether an active or passive connection should be used.
There are other parameters that can be configured in the registry. There’s a documet on the Microsoft web site “FTP Server Registry Settings”

Regards, Andy

Thx for the answer… but if the passive mode should be used, the server must use a static passive port range. The ftp client want to use passive mode, then the server send the passive port to the ftp client. After that the client can use the ftp commands.

I found no informations about the passive port.

Dear @SamFoster

In passive mode, the FTP server uses the bind() function to select a port, which is documented at Microsoft. The relevant statement is:

For TCP/IP, if the port is specified
as 0, the service provider assigns a
unique port to the application with a
value between 1024 and 5000.

Regards, Andy

Yes that is correct. But to use the passive mode through a firewall, the ftp service must use a passive port range. This option is missing in the ftp service on the toradex device.

The passive port is calculated on the local device, so the high value could be upper than 5000.

So the main problem is, a secure connection through a firewall is not possible, because you could not define a static value for the data port.

Regards, Sam

Dear @SamFoster

I’m not a network expert, but from what I read recently about the FTP PASV protocol, the FTP server must be able to choose a random port by definition. With a fixed data port number it would not be possible to establish multiple connections to that server.

However, maybe some FTP servers allow for such a configuration, unfortunately the standard implementation for Windows CE does not. As mentioned above, the FTP server source code is available as part of Platform Builder. If you need a fixed data port, it shouldn’t be too hard to modify the sources and build the server to your needs.

Regards, Andy

The passive port must not be random. The server can use a port range for the passive mode or can use a static port.

I will change the soruce code and i use my own ftp server. The default ce ftp server from the platform builder does not have the feature.

Thx for your help. Greetings.