Results 1 to 1 of 1
Thread: Jakarta FTP via proxy server
- 07-24-2008, 10:12 AM #1
Member
- Join Date
- Jul 2008
- Posts
- 1
- Rep Power
- 0
Jakarta FTP via proxy server
Hi,
I wish to connect to an FTP server. Trouble is that the internet connection goes through a proxy server. I am using the Jakarta package for the FTP.
The process works as follows, if I understand it correctly:
Step 1 - Connect to proxy server
Step 2 - Connect to FTP server.
If I do step 1 manually first (open Internet explorer and type in the user and password to connect myself to the proxy server), then step 2 works fine.
However, if I do not do this, obviously neither step 1 or 2 work.
Here is what I tried first.............
System.getProperties().put("ftp.proxySet","true");
System.getProperties().put("ftp.proxyHost", "proxy.abc.def");
System.getProperties().put("ftp.proxyPort", "80");
System.getProperties().put("ftp.proxyUser", "auser");
System.getProperties().put("ftp.proxyPassword", "apswd");
Then comes the code for part 2 - ie connect to ftp host -
connect("abcd.dfg.ert");
However, when I run the program and it comes to do the actual connection to the FTP host, part 2 above, I get "java.net.ConnectException: Connection timed out: connect".
So, reading around, I saw bits of advice suggesting I need to connect to a SOCKS server as well. So I put the below code in place.
System.getProperties().put( "socksProxyPort", "80");
System.getProperties().put( "socksProxyHost" ,"proxy.abc.def");
However, this gave me the same error as above.
Then I heard that I need to authenticate myself to the SOCKS server.
So, here is what I wrote to do that:
Authenticator.setDefault(new Authenticator(){
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("auser", "apswd".toCharArray());
}
});
I used the same username and passwords as I had used for the ftp.proxyUser and ftp.proxyPassword, because I do not have any other passwords - perhaps this is the incorrect thing to do....?
Then, I got the following exception:
java.net.SocketException: Malformed reply from SOCKS server
Does that mean I am actually connected to the SOCKS server or not, I wonder. I read in a few places that some proxies use SOCKS and some don't. I don't know how to determine whether mine does or not. When I look at the properties of the proxy in Internet explorer, I notice that the SOCKS section is blanked out. I can fill it in myself, of course, but my program still has the same errors as above.
Has anyone else had a similar problem and know how to get around it? Yours desperately..
Similar Threads
-
reading URL using java through proxy server
By asheesh in forum NetworkingReplies: 16Last Post: 04-25-2010, 02:15 PM -
Redirect My Client httpRequests to Proxy server !
By Tareq85 in forum NetworkingReplies: 0Last Post: 06-12-2008, 08:30 AM -
Using jakarta-commons threadpool (Tomcat) through JNDI
By zrrbite in forum Advanced JavaReplies: 0Last Post: 12-14-2007, 12:47 PM -
Jakarta POI 3.0
By levent in forum Java SoftwareReplies: 1Last Post: 11-12-2007, 06:23 AM -
JAKARTA STRUTS book
By Ed in forum New To JavaReplies: 2Last Post: 07-01-2007, 04:36 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks