Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4k views
in Java FTP by
When I tried using 1.4.5 against a Ent Server 2003 IIS, it abruply drops the connection on a quit, so I made small mod to the send command to cope with the drop out. Changes:
public FTPReply sendCommand(String command) throws IOException {

writeCommand(command);
// and read the result
// 11/30/04 dop. some servers just drop the control connection
//( e.g. MS Ent Server 2003) as soon as they get the QUIT if there's
//no data transfer in progress and don't even bother to reply...
if(!command.startsWith("QUIT"))
return readReply();
else { //trap the 2003 server just dropping the connection
try {
return readReply();
}
catch(IOException e) {
//simulate a polite exit...
return new FTPReply("221", "Simulated. Sever dropped connection on 'QUIT'");
}
}
}

1 Answer

0 votes
by (162k points)
Rather than change the code for all servers when this seems to affect the server below, why don't you catch IOException and ignore it when you call the quit() method?

When I tried using 1.4.5 against a Ent Server 2003 IIS, it abruply drops the connection on a quit, so I made small mod to the send command to cope with the drop out. Changes:
public FTPReply sendCommand(String command) throws IOException {

writeCommand(command);
// and read the result
// 11/30/04 dop. some servers just drop the control connection
//( e.g. MS Ent Server 2003) as soon as they get the QUIT if there's
//no data transfer in progress and don't even bother to reply...
if(!command.startsWith("QUIT"))
return readReply();
else { //trap the 2003 server just dropping the connection
try {
return readReply();
}
catch(IOException e) {
//simulate a polite exit...
return new FTPReply("221", "Simulated. Sever dropped connection on 'QUIT'");
}
}
}

Categories

...