Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
–1 vote
593 views
in Java FTP by (110 points)
Hi,

I have a Thread which has it's own FileTransferClient that executes every 3 seconds or so, and if we are expecting files on the FTP Server - the code calls:
fileTransferClient.directoryListing()

However, sometimes we get the error: Control channel unexpectedly closed ('' read so far)

Full Trace:

com.enterprisedt.net.ftp.ControlChannelIOException: Control channel unexpectedly closed ('' read so far)
    at com.enterprisedt.net.ftp.FTPControlSocket.e(FTPControlSocket.java:1065)
    at com.enterprisedt.net.ftp.FTPControlSocket.b(FTPControlSocket.java:1120)
    at com.enterprisedt.net.ftp.FTPControlSocket.sendCommand(FTPControlSocket.java:1019)
    at com.enterprisedt.net.ftp.FTPControlSocket.setDataPort(FTPControlSocket.java:831)
    at com.enterprisedt.net.ftp.FTPControlSocket.a(FTPControlSocket.java:687)
    at com.enterprisedt.net.ftp.FTPControlSocket.a(FTPControlSocket.java:634)
    at com.enterprisedt.net.ftp.FTPControlSocket.a(FTPControlSocket.java:601)
    at com.enterprisedt.net.ftp.FTPClient.createDataSocket(FTPClient.java:2743)
    at com.enterprisedt.net.ftp.FTPClient.a(FTPClient.java:3818)
    at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3912)
    at com.enterprisedt.net.ftp.FTPClient.dirDetails(FTPClient.java:3737)
    at com.enterprisedt.net.ftp.FileTransferClient.directoryList(FileTransferClient.java:693)
    at com.enterprisedt.net.ftp.FileTransferClient.directoryList(FileTransferClient.java:676)

1 Answer

0 votes
by (9.1k points)

The error "Control channel unexpectedly closed" means that the server has disconnected the client. Have a look at your server logs to see if there's a reason given for the disconnection. The server has done this you need to find out why the server disconnected. 

by (110 points)
reshown by
Hi Stuart, thanks for the reply.

I now understand that this error is due to server disconnection - and we can investigate that side.

However, is it possible in the library to check if the connection is no longer established? To stop an exception occurring so we can gracefully log it?
by (162k points)
There's not a consistent way of doing this. The best approach would be to connect, do your file listing and disconnect. You can't indefinitely hold a connection open - it's better to do what you need, disconnect and reconnect again.

Categories

...