When an instance of this structure is passed to the FtpServerStart
function, the dwSize member must be initialized to the size of the
structure, otherwise the function will fail with an error indicating that
the configuration is invalid.
The nMaxClients member limits the total number of client
connections and the nMaxGuests member limits the total number
of guest connections. The server will notify the client if either
number of connections has been exceeded and will automatically close
the connection. However, one difference is that a new client that
exceeds the maximum number of connections will not generate any
events; a client that exceeds the maximum number of guest connections
will generate events. The reason for the difference is that the check for the number
of active clients is made immediately after
the client connects to the server, prior to session context being
created for that client. The check for the number of anonymous clients is made later,
after the client has sent the USER and PASS commands to the server.
For more control over how the server accepts client connections, use
the FtpServerThrottle function.
If the server is running on a system that is behind a firewall that
restricts the range of port numbers for inbound connections, the
nMinPort and nMaxPort members can be used to limit the
ports which the server will use to listen for passive data connections
from clients. By default, the server will use data port numbers that
range from 30000 to 65535, which is typical for many firewall
configurations. If you provide your own port range, the minimum number
of ports available must be at least 1000. Specifying a port range that
is too small will cause the FtpServerStart function to fail
with an error indicating that the server configuration is invalid.
When specifying the root directory for the server
configuration, it is important to consider that a client's access to
files on the system will be limited to these directories and any
subdirectories. If a root directory is not specified, then one will be
created using the current working directory for the process. The root
directory path may include environment variables surrounded by %
symbols and these will be expanded.
If you have configured the server to permit clients to upload files,
you must ensure that your application has permission to create files
in the directory that you specify. A recommended location for the server
root directory would be a subdirectory of the %ALLUSERSPROFILE%
directory. Using the environment variable ensures that your server will
work correctly on different versions of Windows. If the root directory does
not exist at the time that the server is started, it will be created.
For servers that are publicly accessible, or where you want files
to be a accessible across multiple server sessions, you should always
populate the szHostUuid member with a valid UUID string, and
the szDirectory member should specify an absolute path to an
existing directory.
If the FTP_SERVER_MULTIUSER option is specified, the server will
start in multi-user mode, with each user assigned to their own home
directory based on their username. This option will cause the server
to create a directory structure in the root directory that includes
three subdirectories: Public, Users and Logs. The Public directory is
the home directory for anonymous users, and they are isolated to that
directory. The Users directory is where the user home directories are
created. The Logs directory is where log files are created by default.
If this option is not specified, then no subdirectories are created
and all users will share the server root directory by default.
If the FTP_SERVER_LOCALUSER option is specified, the server will
never attempt to authenticate the local Administrator or Guest
accounts. This is done to prevent clients from attempting to probe for
the administrator account password. However, the application can
override this behavior by implementing a handler for the
FTP_CLIENT_LOGIN event.