In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about java ftpclient issues, which may not be well understood by many people. In order to let you know more, Xiaobian summarized the following contents for you. I hope you can gain something according to this article.
java ftpclient problem (sun. net.ftp.ftpClient)
1 sun.net.ftp.ftpProtocolException: PORT :501 PORT not allowed after EPSV ALL, active mode off Many ftp servers transmit in passive mode, which can be resolved with ftpClient.sendServer("PASV"). Do not follow int reply = ftpClient.readServerResponse(); otherwise the problem remains.
java. net.SocketException: Connection reset This problem occurs because the client is closed prematurely before the download is finished. It can also be understood as follows: A stream channel is established between the client and the server. One end of the stream channel enters and the other end exits. When one end continues to enter, you close the exit end, and then a connection reset exception will be reported. Of course, normal should be in the flow after the end, but often in reading a large file, how to judge the end of it? Of course, this can be solved by using the command ftpClient.sendServer("QUIT").
/*FTP REMOTE COMMAND LIST USER PORT RETR ALLO DELE SITE XMKD CDUP FEAT PASS PASV STOR REST CWD STAT RMD XCUP OPTS ACCT TYPE APPE RNFR XCWD HELP XRMD STOU AUTH REIN STRU SMNT RNTO LIST NOOP PWD SIZE PBSZ QUIT MODE SYST ABOR NLST MKD XPWD MDTM PROT
*/ /* Execute commands on the server. If sendServer is used to execute remote commands (local FTP commands cannot be executed), all FTP commands must be accompanied by rn ftpclient.sendServer("XMKD /test/bbrn");
//Execute FTP command ftpclient.readServerResponse on server. Be sure to call nameList("/test") after sendServer to get file list under directory XMKD to establish directory. If directory exists, create directory again and report error XRMD delete directory DELE delete file */[@more@]ftpClient ftpClient = new FtpClient();
//Create FtpClient object ftpClient.openServer(server);
ftpClient.login(user, password); if (path.length() != 0) ftpClient.cd(path); ftpClient.binary();
// ftpClient.sendServer("PASV"); // int reply = ftpClient.readServerResponse(); TelnetInputStream is = ftpClient.get("smit.log");
// TelnetInputStream is = ftpClient.list();
// TelnetInputStream is=ftpClient.nameList(path); int c; while ((c = is.read()) != -1) { System.out.print((char) c); } is.close(); // ftpClient.closeServer();
//exit FTP server
// ftpClient.sendServer("GET smit.logrn"); int reply = ftpClient.readServerResponse(); ftpClient.sendServer("QUITrn");
After reading the above, do you have any further understanding of java ftpclient problem? If you still want to know more knowledge or related content, please pay attention to the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.