Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-462

FTPClient in PASSIVE_LOCAL_DATA_CONNECTION_MODE cannot work when host have several different IP

    XMLWordPrintableJSON

Details

    Description

      When host have several different IP and client setting to PASSIVE_LOCAL_DATA_CONNECTION_MODE,openDataConnection creating socket may use the unexpected ip。
      For example, The host have two Ips, one for intra and the another for extern, only the extern one can be connect with the outside。But when in PASSIVE_LOCAL_DATA_CONNECTION_MODE, FTPClient may be select the intra Ip, So it didn't work。
      So I change code like this, it can work normally by the specific ip.
      Code:
      In FTPClient.openDataConnection(String command, String arg),line 761 change as bellow:
      socket = socketFactory.createSocket();

      // add begin
      // local as client, transfer data must use the appointed local host
      socket.bind(new InetSocketAddress(getHostAddress(), 0));
      // add end

      After log in success,User can set the ip which he want to use by call the method in FTPClient:
      setActiveExternalIPAddress(String ip);

      Attachments

        1. ftp-bindlocal.diff
          2 kB
          Bogdan Drozdowski

        Activity

          People

            Unassigned Unassigned
            yixiuqingfeng Junsheng Chen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified