hi rory,

thx ur prompt response,
but the link  
http://marc.theaimsgroup.com/?l=jakarta-commons-user&m=107877944806547&w=2
states that FTPClient can connect via ftp proxy, am i correct?
and i have tried to switch the proxy to a open src one callled java
socks server, http://jsocks.sourceforge.net/
luckily it seems work for my code,
i can now on connect to the proxy and then ftp to the target ftp
account. i suspect there is problems in my previous proxy
server(BPSlite). i am trying to figure out the problems. i attached is
ftpclient code
hope this help

alex

On 8/16/06, Rory Winston <[EMAIL PROTECTED]> wrote:
Hi Alex

The FTPClient library isn't capable of FTP transactions thru a proxy at present 
(unless there is some external trickery that I'm not aware of that would 
facilitate this). This wouldn't require a huge amount of extra effort - I've 
looked at how Sun have implemented it for their internal JDK FTP client, but 
unfortunately it's not something that's there now.

Rory

"Jakarta Commons Developers List" <[email protected]> wrote:

>
> hi all,
> i am developing a ftpclient.java using commons-net-1.4.1.jar library.
>
> it works fine if not via proxy server. it can login the ftp account
> and list files. But my target is to connect the ftp server via proxy
> server.
>
> by following the Paul Buchana
> here:  
http://marc.theaimsgroup.com/?l=jakarta-commons-user&m=107877944806547&w=2
> i add the following two lines before the connect line
> System.getProperties().put( "socksProxyPort", "7200");
> System.getProperties().put( "socksProxyHost" ,"25.10.22.11"); //
> 25.10.22.11 is proxy server with port 7200
>
> prv_cls_ftpclient.connect("25.10.22.13",21); <-- target ftp server to
> connect, it can connect to ftp server if comment the above
> System.getProperties lines
> reply = prv_cls_ftpclient.getReplyCode();
> System.out.print("Print log reply code"+reply);
> if(!FTPReply.isPositiveCompletion(reply)) {
>         prv_cls_ftpclient.disconnect();
>         System.err.println("FTP server refused connection.");
>         System.exit(1);
> }
> System.out.print("Print log Connection");
> prv_cls_ftpclient.login("user", "pass");
>
> but it stop at the .connect line without further proceed, what's wrong
> with my code. any miss setting i should did?? or is it possible to a
> ftp server via a proxy server?
>
> I am using a lite proxy server called Binary Proxy Server BPSLite.exe on 
windows
> --
> Regards,
> Alex
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-----------------------------------------------------------------
Find the home of your dreams with eircom net property
Sign up for email alerts now http://www.eircom.net/propertyalerts



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Regards,
Alex
import java.io.PrintWriter;
import java.net.InetAddress;

import org.apache.commons.net.ftp.FTPReply;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPClientConfig;
import org.apache.commons.net.ProtocolCommandEvent;
import org.apache.commons.net.ProtocolCommandListener;

public class ftpClient2{

        public static void main(String arg[]) throws Exception
        {
          int reply;
                FTPClient prv_cls_ftpclient = new FTPClient();
                System.out.println("Client2 Print log get data 
mode:"+prv_cls_ftpclient.getDataConnectionMode());
                System.getProperties().put("socksProxyPort","1099");
                System.getProperties().put("socksProxyHost","x.x.x.x"); //ip 
address
                
                System.out.print("Print log before Connecting");
                prv_cls_ftpclient.connect("x.x.x.x");
                reply = prv_cls_ftpclient.getReplyCode();
                System.out.print("Print log reply code"+reply);
                if(!FTPReply.isPositiveCompletion(reply)) {
                        prv_cls_ftpclient.disconnect();
                        System.err.println("FTP server refused connection.");
                      System.exit(1);
                }
                System.out.print("Print log Connecting");
                prv_cls_ftpclient.login("user", "password");
                System.out.print("Print log Login");
                if(prv_cls_ftpclient.isConnected())
                {
                        System.out.println("connected !");
                        prv_cls_ftpclient.enterLocalPassiveMode() ;     
                        String filelist [] = prv_cls_ftpclient.listNames();
                        for(int i=0;i<filelist.length;i++)
                        {       
                                System.out.println(filelist[i]);        
                        }
                        prv_cls_ftpclient.logout();
                        System.out.println("Print log: Logout Successfully");   
        
                }
                else
                        System.out.println("Fail to connect !");
        
                prv_cls_ftpclient.disconnect();
        }

}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to