The SetAddress method changes the IP address that
the server will use when a client transfers a file using a passive
mode data connection. In passive mode, the server will create a second
passive (listening) socket that will accept an incoming connection
from the client. The server sends the IP address and port number
allocated for that socket to the client, and the client establishes
the data connection to the server using that address. The IP address
that the server sends to the client is normally the same as the IP
address that the client used to establish the control connection,
however if the server is located behind a router that performs Network
Address Translation (NAT), the IP address reported to the client may
not be usable.
This method enables your application to set the external IP
address for the server to a specific value, rather than the server
attempting to automatically discover its own external address. If you
wish to set the external address for the server manually, call the
Start method without the FTP_SERVER_EXTERNAL option and
then call this method to set the external IP address to the desired
value.
This method will not change the IP address the server is using to
listen for client connections. The only way to change the listening IP
address is to stop and restart the server using the new address. This
method only changes the IP address that is reported to clients when
a passive data connection is used. Incorrect use of this method can
prevent the client from establishing a data connection to the server.
The address must be in the same address family as the local address
that the server was started with. For example, if the server was
started using an IPv4 address, the IP address passed to this method
cannot be an IPv6 address.