FTPClient and CopyStreamAdapter stop sometimes

Discussion in 'Java' started by Susanne Kaufmann, Jun 27, 2008.

  1. I have an applet which Downloads some files from an FTP(S) Server.
    Mostly everything works fine, but sometimes the application "stops"
    for a long time (several minutes) after the "RETR filename" command.
    PErhaps someone knows this problem or has an idea.

    Thank you in advance for any hint,

    Susanne


    Here is some of my code:

    try {
    InputStream stO =
    new BufferedInputStream(
    ftps.retrieveFileStream(fileName),
    ftps.getBufferSize());

    org.apache.commons.net.io.Util.copyStream(
    stO,
    fout,
    ftps.getBufferSize(),
    //
    org.apache.commons.net.io.CopyStreamEvent.UNKNOWN_STREAM_SIZE,
    length,
    new org.apache.commons.net.io.CopyStreamAdapter() {
    public void bytesTransferred(long
    totalBytesTransferred,
    int bytesTransferred,
    long streamSize) {
    changeSupport.firePropertyChange(FTPPERCENT, null,
    totalBytesTransferred*100/length);
    }
    });
    } catch (Exception e) {
    e.printStackTrace();
    }
    Susanne Kaufmann, Jun 27, 2008
    #1
    1. Advertising

  2. On Fri, 27 Jun 2008 00:44:53 -0700, Susanne Kaufmann wrote:

    > I have an applet which Downloads some files from an FTP(S) Server.
    > Mostly everything works fine, but sometimes the application "stops"
    > for a long time (several minutes) after the "RETR filename" command.
    > PErhaps someone knows this problem or has an idea.
    >

    Do you know whether the pause is at the machine running the applet or at
    the server end?

    If you use a bare web browser to do the download do you see pauses?


    --
    martin@ | Martin Gregorie
    gregorie. |
    org | Zappa fan & glider pilot
    Martin Gregorie, Jun 28, 2008
    #2
    1. Advertising

  3. It is at the client site, because I can download from the server
    without pauses using a ftp client or the bare browser.
    Susanne Kaufmann, Jun 30, 2008
    #3
  4. On Mon, 30 Jun 2008 02:21:28 -0700 (PDT), Susanne Kaufmann wrote:
    > It is at the client site, because I can download from the server
    > without pauses using a ftp client or the bare browser.


    Is the client behind a firewall? Do you use ftp in passive or active
    mode? Can you download without problems from a different ftp server?

    Instead of guessing what might be causing the problem, use a tool like
    Wireshark to see what's really happening between your client and the
    server. Remember that there are two active connections: one for
    transferring commands, and one for transferring data.

    /gordon

    --
    Gordon Beaton, Jun 30, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Saunders
    Replies:
    0
    Views:
    450
    John Saunders
    Aug 28, 2003
  2. Nehmo Sergheyev
    Replies:
    1
    Views:
    492
    Andrew Urquhart
    May 9, 2004
  3. Marcin Vorbrodt

    ::std sometimes needed, sometimes not

    Marcin Vorbrodt, Sep 16, 2003, in forum: C++
    Replies:
    24
    Views:
    746
    Jerry Coffin
    Sep 17, 2003
  4. Replies:
    1
    Views:
    491
    gkelly
    Nov 29, 2006
  5. Kamyk
    Replies:
    2
    Views:
    164
    Thomas 'PointedEars' Lahn
    May 8, 2005
Loading...

Share This Page