Connecting from behind a firewall |
The Ftps component is firewall friendly in that by default it uses a firewall friendly passive connection. Some firewall however may require that you route all connections thru the firewall. To do this you must change the arguments passed to the Ftps constructor.
Example
The example below routes the FTP connection thru the firewall.
// define connection setting int firewallPort = 21; String firewallHostname = "192.168.1.1"; String ftpHostname = "ftp.myhost.com"; String ftpUsername = "jsmith"; String ftpPassword = "secret";
// create new Ftps instance Ftps ftp = new Ftps(firewallHostname, ftpUsername + "@" + ftpHostname, ftpPassword, firewallPort);
// establish connection thru firewall ftps.connect();
See also
Connecting thru a proxy server
|