Connecting thru a proxy server

Top  Previous  Next

The Ftp class allows for connections through HTTP and SOCKS5 proxy servers.  To use a proxy server invoke the Ftp#setProxyHost method passing a proxy hostname and port as arguments.

 

Example

 

// proxy information

String proxyHost = "10.0.0.1";

int proxyPort = 2121;

 

// create Ftp instance and set proxy information

Ftp ftp = new Ftp(hostname,username,password);

ftp.setProxyHost(proxyHost,proxyPort);

ftp.setProxyType("SOCKS5");

ftp.connect();

 

If your proxy requires authentication you can set this using the Ftp#setProxyAuthentication method.

 

Example

 

String proxyUsername = "jsmith";

String proxyPassword = "secret";

 

ftp.setProxyAuthentication(proxyUsername,proxyPassword);

 

 

See also

 

Connecting from behind a firewall





Home | Company | Products | Solutions | Purchase | Support | Services | Blog

© 2021 JSCAPE LLC