Date: 2004-09-09T11:48:01 Editor: DanielSavarese <[EMAIL PROTECTED]> Wiki: Jakarta Commons Wiki Page: Net/FrequentlyAskedQuestions URL: http://wiki.apache.org/jakarta-commons/Net/FrequentlyAskedQuestions
no comment Change Log: ------------------------------------------------------------------------------ @@ -1,5 +1,27 @@ This document attempts to answer some of the more frequently asked questions regarding various aspects of CommonsNet. These questions are typically asked over and over again on the mailing lists, as a courtesy to the developers, we ask that you read this document before posting to the mailing lists. ---- +'''Q: How can I set a connection timeout?''' + +'''A:''' setDefaultTimeout does not set the connect timeout. It provides a default +socket timeout. Only in J2SE 1.4 was the ability to specify a timeout +on connect added to the Socket API. Since Commons Net 1.2.x has a +J2SE 1.2 compatibility requirement, the ability to specify a connect +timeout is not included. The way to workaround this is to implement your +own `SocketFactory` and set it with `SocketClient.setSocketFactory` (`FTPClient` is +a subclass of `SocketClient`). When you implement the `SocketFactory`, add +a setConnectTimeout method or some such. Inside of the createSocket +methods, use the J2SE 1.4 connect method with the timeout. We could actually +provide socket factory that subclasses `DefaultSocketFactory` to do this without +breaking backward compatibility, but that would have to be discussed further. +The way to do it is to compile it only if J2SE >= 1.4 is being used. +`SocketClient` could check for availability of the J2SE 1.4 connect method and +instantiate the J2SE >= 1.4 factory if available (using Class.forName and +newInstance). The setDefaultTimeout method could then be changed to also set the +connect timeout in the new factory if being used. If users want this +functionality enough, the best chance of getting it implemented soon is +to submit a patch. + +---- '''Q: On which server operating systems is FTPClient able to bring back a parsed listing?''' '''A:''' Currently parsers have been written for UNIX, NT, OS/2 and VMS and OS400. These can be autodetected by the code without being specified. Additionally, the code correctly handles cases where NT or OS400 servers have been configured to look like unix servers. There is also a means of specifying a user-written parser by class name. All of these parsers return FTPFile objects with as much information about the file as can be gathered from the listing. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
