|
One additional note:
Point #4 (misfiring of soTimeout if client is idle) can be avoided by calling Regarding 1, isConnected is not supposed to notice if a connection has
terminated abnormally. It is intended that one catch an exception in such a case. 4. The socket timeout is exactly that. If there's no activity on a socket 5. setDefaultTimeout is merely the socket timeout to set after a connection Re: setReaderThread
I didn't know we had such a method. It looks like it was added here: http://cvs.apache.org/viewcvs.cgi/jakarta-commons/net/src/java/org/apache/commons/net/telnet/TelnetClient.java?rev=1.9&view=markup Other than adding documentation to FTPClient about this, it sounds like Indeed, if point #1 (ftp.isConnected()) is the intended behavior, and if #5
(connect timeout) cannot be addressed in JDK 1.2, then the only action left is indeed #4, i.e. a documentation fix. Or maybe, it could be fixed in the code by testing __readIsWaiting in The root of the problem is the nasty telnet code. As I indicated on
commons-dev in response to a related issue: I think the long term solution should be to branch, leaving the 1.2 series as J2SE 1.2 and 1.3 compatible, and reimplement telnet using selectable I/O in a single thread on the head branch; or start a new 2.0 branch either as a branch or in the sandbox as commons-net2, since everything would have to be overhauled once we start using java.nio. Basically, I think we're seeing enough user demand that we should contemplate the move to J2SE 1.4, even if we have to maintain two separate branches (although I prefer the commons-net2 approach). I think we've taken incremental patching as far as we can. On a separate note, the whole isConnected behavior issue needs to be I inserted a a short note and a link in the Javadoc to this thread. Will close
for now. Reclosing so it gets marked as Fixed. Jira migration bug.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
SocketTimeout exceptions) was actually due to an artifact of vsftpd that we
used for testing. Please disregard these item, sorry for the confusion.
However the following point still stands:
1. ftp.isConnected() does not notice that connection has been closed
Additionnally, there are 2 new points:
4. The timeout set by setSoTimeout misfires if the client hasn't submitted a
request for a while. Probably some internal thread is waiting permanently for
server "responses" even if the client didn't send the server anything to
respond to. IMHO, timeout should only be triggered if an expected response
doesn't come.
5. There apparently is no way of setting a timeout for the initial connection
request. Even setDefaultTimeout doesn't work for completely that purpose, as
can be easily checked by attempting to connect to an unreachable IP address.