Author: sebb
Date: Sat Mar  5 19:58:09 2011
New Revision: 1078337

URL: http://svn.apache.org/viewvc?rev=1078337&view=rev
Log:
Allow EPSV with IPV4

Modified:
    commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java

Modified: 
commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java?rev=1078337&r1=1078336&r2=1078337&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java 
(original)
+++ commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java 
Sat Mar  5 19:58:09 2011
@@ -47,7 +47,7 @@ public final class FTPClientExample
 {
 
     public static final String USAGE =
-        "Usage: ftp [-s] [-b] [-l] [-a] [-k secs [-w msec]] [-#] <hostname> 
<username> <password> <remote file> <local file>\n" +
+        "Usage: ftp [-s] [-b] [-l] [-a] [-e] [-k secs [-w msec]] [-#] 
<hostname> <username> <password> <remote file> <local file>\n" +
         "\nDefault behavior is to download a file and use ASCII transfer 
mode.\n" +
         "\t-s store file on server (upload)\n" +
         "\t-l list files (local file is ignored)\n" +
@@ -55,6 +55,7 @@ public final class FTPClientExample
         "\t-k secs use keep-alive timer (setControlKeepAliveTimeout)\n" +
         "\t-w msec wait time for keep-alive reply 
(setControlKeepAliveReplyTimeout)\n" +
         "\t-a use local active mode (default is local passive)\n" +
+        "\t-e use EPSV with IPv4 (default false)\n" +
         "\t-b use binary transfer mode\n";
 
     public static final void main(String[] args)
@@ -62,6 +63,7 @@ public final class FTPClientExample
         int base = 0;
         boolean storeFile = false, binaryTransfer = false, error = false, 
listFiles = false;
         boolean localActive = false;
+        boolean useEpsvWithIPv4 = false;
         String server, username, password, remote, local;
         final FTPClient ftp = new FTPClient();
 
@@ -76,6 +78,9 @@ public final class FTPClientExample
             else if (args[base].equals("-b")) {
                 binaryTransfer = true;
             }
+            else if (args[base].equals("-e")) {
+                useEpsvWithIPv4 = true;
+            }
             else if (args[base].equals("-l")) {
                 listFiles = true;
             }
@@ -172,6 +177,8 @@ __main:
                 ftp.enterLocalPassiveMode();
             }
 
+            ftp.setUseEPSVwithIPv4(useEpsvWithIPv4);
+
             if (storeFile)
             {
                 InputStream input;


Reply via email to