FTPClient.listFiles throw exception when connect to an IPv6 FTP server
----------------------------------------------------------------------

                 Key: NET-347
                 URL: https://issues.apache.org/jira/browse/NET-347
             Project: Commons Net
          Issue Type: Test
          Components: FTP
         Environment: jdk 1.6, commons-net-2.2.jar
            Reporter: jones wen


If i setup the IPv6 FTP server on localhost, it is OK.
If the IPv6 FTP server is on saloris 10(external host), FTPClient.listFiles() 
will throw below exception,
java.net.BindException: Cannot assign requested address: JVM_Bind
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(Unknown Source)
        at java.net.ServerSocket.bind(Unknown Source)
        at java.net.ServerSocket.<init>(Unknown Source)
        at javax.net.DefaultServerSocketFactory.createServerSocket(Unknown 
Source)
        at 
org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:515)
        at 
org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2545)
        at 
org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2519)
        at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2276)
        at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2322)
        at FtpTest.main(FtpTest.java:29)


the test code is,

        FTPClient client = new FTPClient();
        try {
                        
client.connect(Inet6Address.getByName("2010::214:4fff:fe4d:2c4b"), 21);
                        client.login("abc", "abc");

                        client.enterLocalActiveMode();
                        
client.setActiveExternalIPAddress("2010::214:4fff:fe4d:2c4b");
                        
                        FTPFile[] list = client.listFiles();
                        if(list != null && list.length > 0) {
                                for(int i=0; i<list.length; i++) {
                                        System.out.println(list[i].getName());
                                }

                        }
                } catch (SocketException e) {
                        e.printStackTrace();
                } catch (UnknownHostException e) {
                        e.printStackTrace();
                } catch (IOException e) {
                        e.printStackTrace();
                }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to