FTP SocketTimeoutException even with using passive mode
We are using commons-net-1.4.1.jar and java5_64 on AIX. I am getting the following exception on listing files on an FTP server.
java.ne开发者_运维知识库t.SocketTimeoutException: Accept timed out at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:427) at java.net.ServerSocket.implAccept(ServerSocket.java:466) at java.net.ServerSocket.accept(ServerSocket.java:434) at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:502) at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2488)
This error is intermittent as the process runs around 60 times a day and I'm getting the error 2 or 3 times, the rest of the time it runs fine.
I found a possible solution on the internet of changing the connection mode from active to passive, however this is not helping either.
Could you please help me, I don't know what may be the cause.
the remote server you are trying to list files from is simply not responding... (which is a fairly common case). either their internet connection is down at this moment, or your own internet connection is down, or the server is saturated and refusing connections, or whatever may be the case.
(do you properly close the connection to the server each time the process succeeds ? the server may be refusing the connection because it thinks you are already connected)
If everything is correct in connection i.e Passive and ASCII as per server, and still you are getting socket timeout then increase the time in connection under ftpClient.setTimeout(220);
精彩评论