Connecting from behind a firewall

Top  Previous  Next

The Ftp class 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 Ftp 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 Ftp instance

Ftp ftp = new Ftp(firewallHostname, ftpUsername + "@" + ftpHostname, ftpPassword, firewallPort);

 

// establish connection thru firewall

ftp.connect();

 

 

See also

 

Connecting thru a proxy server

 

 

 

 

 

 

 





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

© 2021 JSCAPE LLC