FTPClient and CopyStreamAdapter stop sometimes

S

Susanne Kaufmann

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();
}
 
M

Martin Gregorie

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?
 
S

Susanne Kaufmann

It is at the client site, because I can download from the server
without pauses using a ftp client or the bare browser.
 
G

Gordon Beaton

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

--
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top