commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Buchanan, Paul" <Paul.Bucha...@thomson.com>
Subject RE: [net] FTPClient through a FTP proxy
Date Mon, 08 Mar 2004 20:57:18 GMT
On Friday, March 05, 2004 1:24 PM, Buchanan, Paul wrote:
> I have been trying to establish a ftp connection through a FTP proxy
> using the FTPClient, but as of yet have been unsuccessful.  I did
> search the list, but didn't find anything useful.
> 
> These are the things I have been trying:
> 
>       System.getProperties().put( "ftp.proxySet", "true" );
>       System.getProperties().put( "ftp.proxyHost", "hostname" );
>       System.getProperties().put( "ftp.proxyPort", "21" );
> OR
>       System.getProperties().put( "ftProxySet", "true" );
>       System.getProperties().put( "ftpProxyHost", "hostname" );
>       System.getProperties().put( "ftpProxyPort", "21" );
> 
> then the following code:
> 
>       FTPClient ftp = new FTPClient();
>       ftp.addProtocolCommandListener(
>          new PrintCommandListener(new PrintWriter(System.out)));
>       try
>       {
>          int reply;
>          ftp.connect(mFTPServer);
> 
> Neither of those sets of System properties seem to do anything, my
> connections just time out.  Is this the correct way of going about
> this? 
> 
> Thanks,
> 
> Paul Buchanan
> West Application Technology
> email: paul.buchanan@thomson.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org

Answering my own question:

Since the Net project uses java.net.Socket under the covers, you have to set
up the Socket settings.  If the proxy you are using is a SOCKS4 or SOCKS5
proxy, you can set the following System Properties:

      System.getProperties().put( "socksProxyPort", "1080");
      System.getProperties().put( "socksProxyHost" ,"proxy.host.address");

>From what I can tell, 1080 is the default port for SOCKS proxies.  The
following site documents many of the networking System Properties available:

http://java.sun.com/j2se/1.4.2/docs/guide/net/properties.html

Hope this helps someone else.

Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message