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:

Java Code:
TelnetInputStream in = this.parent.ftp.get(externalFileName);
and later

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);
and after closing all those streams,

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.
This is not all the code here of course, but just what you need to see I think.