This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I am using org.apache.commons.net.ftp.FTPClient class to connect to a remote server for FTP.
My doubt is that if I connect to the FTP Server using ftp.connect(), where ftp is a object of class FTPClient, I dont explicitly call ftp.disconnect() and again try connecting to the FTP Server through ftp.connect(), will it reuse the connection if it has not timedout?
The catch is that I create a new FTPClient object each time I call connect(), somethin like this..
FTPClient ftp = null; ftp = new FTPClient(); ftp.connect(); ftp = new FTPClient(); ftp.connect();
Will it physically connect each time, or FTPClient(It uses Socket to connect) is optimized to reuse an exisitng open connection, inspite of the fact that I am creating a new object of FTPClient() each time?