Q:

Difference between ftp apache setDefaultimeout() , setSoTimeout() and setDataTimeout()

The following blog  explains about the ftp apache commens net libaray's different timeout viz setDefaultTimeout(),setSoTimeout(),setDataTimeout().
http://sudhirvn.blogspot.in/2007/05/ftpclient-timeout-values.html
But please clarify my following doubts WRT the above mentioned timeouts?
a)Does setSoTimeout() sets timeout only for ftp control connnetion and not data connection ?
b)Does setDataTimeout() sets timeout only for ftp data connection and not control connection ?(I am asking this because it uses the underlying java.net.Socket.setSoTimeout() )
c)If we set setDefaultTimeout() ,then we dont need set/use setSoTimeout() and setDataTimeout() ?since the blog says that  'setDefaultTimeout() is used default for all connections made using this FTPClient instance.'
d)Also do we need set connection timeout ? if we dont set it ,will the program rely on opearting system connection timeouts ?
Thanks in advance :)

A:

The three methods all trigger a call to setSoTimeout() at the socket level.
setDefaultTimeout() is called prior to connecting and passes the timeout value to socket.setSoTimeout() for all future control connections.  The default is 0, which means infinite timeout.  FTPClient.setSoTimeout() is used after a connection is established as an override to the current socket SO_TIMEOUT setting and applies only to the current control connection socket.  
setDataTimeout() sets the timeout for reading from the data connection.  Looking at the code, a value of 0 is essentially the default (infinite wait). 
You would only want to call these methods if you want something different than the default timeout (infinite).
I determined all this from reading the docs and checking the source code, so if someone sees something wrong with what I said, please correct me.

