Results 1 to 1 of 1
Thread: Ftpclient abort download
- 01-06-2009, 04:18 PM #1
Member
- Join Date
- Jan 2009
- Posts
- 1
- Rep Power
- 0
Ftpclient abort download
Hi,
I'm using sun's FtpClient class to do some ftp stuff.
My question is, how should I abort a download halfway through properly?
This is my code, run from a separate thread:
and laterJava Code:TelnetInputStream in = this.parent.ftp.get(externalFileName);
and after closing all those streams,Java Code:File file = new File(localFileName); fos = new FileOutputStream(file); bos = new BufferedOutputStream(fos); dos = new DataOutputStream(bos); byte[] buffer = new byte[1024]; int numRead; while ((!this.stop) && ((numRead = in.read(buffer)) != -1)){ dos.write(buffer, 0, numRead); }
This is not all the code here of course, but just what you need to see I think.Java Code:if (this.stop){ // I don't know what to do here // I've tried the obvious 'this.parent.ftp.sendServer("ABOR");' // but I get a "Error reading FTP pending reply" error when I try to do something next with the client no matter what I try it seems. // I even tried disconnecting and reconnecting to properly abort the download, but i get the same error upon the disconnection attempt. }
Similar Threads
-
Software caused connection abort: socket write error
By kuguy in forum NetworkingReplies: 3Last Post: 04-13-2010, 03:43 PM -
Download JDK 1.5
By Nick15 in forum New To JavaReplies: 4Last Post: 01-01-2009, 03:10 AM -
What jdk do I download?
By padutch2 in forum New To JavaReplies: 3Last Post: 11-29-2007, 04:28 AM -
problems sun.net.ftp.FtpClient
By tommy in forum Advanced JavaReplies: 1Last Post: 08-06-2007, 04:01 AM -
I could download JDK 1.5
By Albert in forum New To JavaReplies: 2Last Post: 07-13-2007, 03:36 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks