FtpClient storeFile always return False

后端 未结 5 1485
醉话见心
醉话见心 2020-12-05 18:36

Please figure this out. The code runs properly without any exception.

        FTPClient ftp = new FTPClient();
        ftp.connect(server);
        if(!ftp.l         


        
5条回答
  •  天命终不由人
    2020-12-05 19:41

    The exact failure message can be found by calling FtpClient#getReplyCode(). From that page (my emphasis):

    Immediately after connecting is the only real time you need to check the reply code (because connect is of type void). The convention for all the FTP command methods in FTPClient is such that they either return a boolean value or some other value. The boolean methods return true on a successful completion reply from the FTP server and false on a reply resulting in an error condition or failure. The methods returning a value other than boolean return a value containing the higher level data produced by the FTP command, or null if a reply resulted in an error condition or failure. If you want to access the exact FTP reply code causing a success or failure, you must call getReplyCode after a success or failure.

    To see what a return code means, you can see Wikipedia: List of FTP server return codes.

提交回复
热议问题