Connecting thru a proxy server |
The Ftps component allows for connections through HTTP and SOCKS5 proxy servers. To use a proxy server invoke the Ftps#setProxyHost method passing a proxy hostname and port as arguments.
Example
// proxy information String proxyHost = "10.0.0.1"; int proxyPort = 2121;
// create Ftps instance and set proxy information Ftps ftps = new Ftp(hostname,username,password); ftps.setProxyHost(proxyHost,proxyPort); ftps.setProxyType("SOCKS5"); ftps.connect();
If your proxy requires authentication you can set this using the Ftps#setProxyAuthentication method.
Example
String proxyUsername = "jsmith"; String proxyPassword = "secret";
ftps.setProxyAuthentication(proxyUsername,proxyPassword);
See also
Connecting from behind a firewall |