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

org.apache.commons.net.ftpFTPClient, file will not be totally transferred.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 3.0
    • None
    • FTP
    • None
    • Windows XP FTPClient program sending file to Windows 2003 IIS FTP Server

    Description

      If I use this ftp.storeFile(f.getName(), stream) to transfer file to the FTP Server. After the function returned the file will be partially sent.
      E.g. If the file has 1025 bytes, only 1024 bytes will be sent while if the file has 2050 bytes, only 2048 bytes will be sent.
      That's because the default buffer size is 1024, each time 1024 bytes of file content will be sent to the FTP server. But stream.flush() is not called at the end of each transfer. Finally, socket stream to FTP server will be closed before the
      last transmission and the last frame of data, which may be less than 1024, will be left unsent.

      My way of fixing this BUG: Change the content of method FtpClient.__storeFile(), change the last parameter for calling Util.copyStream() to 'true'.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pilgrim_yang tom yang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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