Search code examples
javacpanelftp4j

when issuing a logout command to my cpanel ftp server, it returns a 500 error unknown command


I am using it.sauronsoftware.ftp4j with a cpanel server and when I try to close the connection, I am getting a 500 error: unknown command. I assume that means that the cpanel ftp server is using a different command but I don't know how to issue the proper command to close the ftp connection or even what that command is.

I am aware of abruptlyCloseCommunication() but I would prefer a clean and proper method for closing connections.


Solution

  • abruptlyCloseCommunication() method causes the communication channel to be abruptly closed. It is gives as an "emergency brake" to close the control connection when it is blocked. A thread-safe solution for the same purpose is a call to disconnect(false).

    Instead you can use client.disconnect(true); class, This one sends the FTP QUIT command to the remote server, requesting a legal disconnect procedure. Hope it will also work for cpanel.