Connection reset when calling disconnect() using enterprisedt's ftp java framework
Posted
by Frederik Wordenskjold
on Stack Overflow
See other posts from Stack Overflow
or by Frederik Wordenskjold
Published on 2010-05-28T15:18:15Z
Indexed on
2010/05/28
15:21 UTC
Read the original article
Hit count: 376
I'm having trouble disconnecting from a ftp-server, using the enterprisedt java ftp framework.
I can simply not call disconnect() on a FileTransferClient object without getting an error.
I do not do anything, besides connecting to the server, and then disconnecting:
// create client
log.info("Creating FTP client");
ftp = new FileTransferClient();
// set remote host
log.info("Setting remote host");
ftp.setRemoteHost(host);
ftp.setUserName(username);
ftp.setPassword(password);
// connect to the server
log.info("Connecting to server " + host);
ftp.connect();
log.info("Connected and logged in to server " + host);
// Shut down client
log.info("Quitting client");
ftp.disconnect();
log.info("Example complete");
When running this, the log reads:
INFO [test] 28 maj 2010 16:57:20.216 : Creating FTP client
INFO [test] 28 maj 2010 16:57:20.263 : Setting remote host
INFO [test] 28 maj 2010 16:57:20.263 : Connecting to server x
INFO [test] 28 maj 2010 16:57:20.979 : Connected and logged in to server x
INFO [test] 28 maj 2010 16:57:20.979 : Quitting client
ERROR [FTPControlSocket] 28 maj 2010 16:57:21.026 : Read failed ('' read so far)
And the stacktrace:
com.enterprisedt.net.ftp.ControlChannelIOException: Connection reset
at com.enterprisedt.net.ftp.FTPControlSocket.readLine(FTPControlSocket.java:1029)
at com.enterprisedt.net.ftp.FTPControlSocket.readReply(FTPControlSocket.java:1089)
at com.enterprisedt.net.ftp.FTPControlSocket.sendCommand(FTPControlSocket.java:988)
at com.enterprisedt.net.ftp.FTPClient.quit(FTPClient.java:4044)
at com.enterprisedt.net.ftp.FileTransferClient.disconnect(FileTransferClient.java:1034)
at test.main(test.java:46)
It should be noted, that I without problems can connect, and do stuff with the server, like getting a list of files in the current working directory. But I cant, for some reason, disconnect! I've tried using both active and passive mode.
The above example is by the way copy/pasted from their own example. I cannot fint ANYTHING related to this by doing a Google-search, so I was hoping you have any suggestions, or experience with this issue.
© Stack Overflow or respective owner