Tag: connection timeout

收到FTP响应421。 服务器关闭连接

我正在编写一个JAVA代码,使用Apache Commons Net FTPClient遍历FTP位置并在Excel文件中获取输出。 代码正确执行大约5分钟,但然后给出IOException: org.apache.commons.net.ftp.FTPConnectionClosedException: FTP response 421 received. Server closed connection. 我正在使用commons-net-3.0.1.jar。 我做了一些研发并尝试过: setDefaultTimeout(6000); setConnectTimeout(3000); setSoTimeout(3000); enterLocalPassiveMode(); 并发送NOOP ,但仍然得到相同的错误。 我想要做的就是遍历一个目录,如果找到文件,那么在excel中找到文件名和文件更新日期,如果找到了目录,那么进入内部直到再找到文件。 请帮忙询问是否需要其他信息。 我是JAVA的新手。

为什么JavaMail连接超时太长

在我的应用程序中,我连接到服务器以validation用户。 这是代码: try { Properties prop = new Properties(); prop.put(“mail.smtp.starttls.enable”,”true”); prop.put(“mail.smtp.auth”, “true”); prop.put(“mail.smtp.connectiontimeout”, 1000); Session session = Session.getInstance(prop, null); Transport transport = session.getTransport(“smtp”); transport.connect(“mion.elka.pw.edu.pl”, 587, registerLog, registerPass); transport.close(); return true; } catch (NoSuchProviderException ex) { Logger.getLogger(RegisterController.class.getName()).log(Level.SEVERE, null, ex); return false; } catch(AuthenticationFailedException ex) { Logger.getLogger(RegisterController.class.getName()).log(Level.SEVERE, null, ex); return false; } catch (MessagingException ex) { Logger.getLogger(RegisterController.class.getName()).log(Level.SEVERE, […]