I am trying to store a file into a ftp server using apache commons java library. I am using commons-net-3.0.1.jar. The problem is when ever i try to push the file into server, the call
StoreFile()
returns false always. It doesn’t throw any exception. nothing at all,just reply false silently. If i try to push the file manually i.e using normal “ftp” client in linux systems (I meant connecting to ftp server using ftp command and storing the file using put command), then it puts the file into server.
I have no idea of how to debug it even. Can you please let me know how i can get to know the problem and its solution.
I checked the server logs, when ever i am trying to post through java the log says 425 response code failed to establish connection. But when i use manually it shows 226 response.
Note: FTP is not a reliable protocol to upload/download data to/from a server with code. If you need a reliable solution, FTP is not for you. Try ssh instead.
To answer your question: Add a
ProtocolCommandListenerto yourSocketClient(FTPextends this). Then you can at least print the messages inProtocolCommandListener()andprotocolReplyReceived()