This method is used to modify the range of local port numbers used
for active mode file transfers. When using active mode, the client
listens for an inbound connection from the server rather than
establishing an outbound connection for the data transfer. In most
cases, passive mode transfers are preferred because they mitigate
potential compatibility issues with firewalls and NAT routers.
If active mode transfers are required, the default port range used
when listening for the server connection is between 1024 and 5000.
This is the standard range of ephemeral ports used by the Windows
operating system. However, under some circumstances that range of
ports may be too small, or a firewall may be configured to deny
inbound connections on ephemeral ports. In that case, the
SetActivePorts method can be used to specify a different range
of port numbers.
While it is technically permissible to assign the low and high
port numbers to the same value, effectively specifying a single
active port number, this is not recommended as it can cause the
transfer to fail unexpectedly if multiple file transfers are
performed. A minimum range of at least 1000 ports is recommended. For
example, if you specify a low port value of 40000 then it is
recommended that the high port value be at least 41000. The maximum
port value is 65535.
To determine the current range of active port numbers being used,
call the GetActivePorts method.