Hi Bruce,
Thanks for ur reply.
Below is the code that i've used to do the FTP .
*********** ***********************************
package test;
import com.enterprisedt.net.ftp.FTPClient;
import com.enterprisedt.net.ftp.FTPTransferType;
import com.enterprisedt.net.ftp.FTPException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class PutFile
{
FTPClient ftp = null;
BufferedReader reader = null;
int port = 21;
public PutFile(String hostName,String userName,String password)
{
reader = new BufferedReader(new InputStreamReader(System.in));
try
{
ftp = new FTPClient(hostName,port);
ftp.debugResponses(true);
ftp.login(userName,password);
ftp.setType(FTPTransferType.BINARY);
ftp.setTimeout(1000);
}
catch(IOException ex)
{
System.out.println("IO EXCPETION " + ex);
}
catch(Exception ex)
{
System.out.println("Exception in Constructor " +ex);
}
}
public static void main(String args[])
{
PutFile client = new PutFile(args[0],args[1],args[2]);
try
{
System.out.println("Enter the source file ");
String source = client.reader.readLine();
System.out.println("Enter the remote file name");
String dest = client.reader.readLine();
client.putFile(source,dest);
}
catch(Exception ex )
{
System.out.println("Exception in Main ---" + ex);
}
}
public boolean putFile(String source,String dest)
{
try
{
ftp.put(source,dest);
}
catch(FTPException ex )
{
System.out.println(" FTP Exception while putting file -->>" + ex.getReplyCode() +":: MESSSSSSS ::: "+ ex.getMessage());
ex.printStackTrace();
}
catch(Exception ex )
{
System.out.println("Exception in while putting file--" + ex);
}
return false;
}
}
******************************************************************************
I have set the Timeout to 1000 milliseconds...Here is the DEBUG Output of the above code.
It seems the setTimeout takes no effect.
OUTPUT :::
**************
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 23 Jun 2006 20:52:25.848 : ---> PASV
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 23 Jun 2006 20:52:25.849 : 227 Entering Passive Mode (192,168,113,230,149,82)
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 23 Jun 2006 20:52:25.853 : ---> STOR My.zip
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 23 Jun 2006 20:52:25.921 : 150 Go ahead make my day^W^W^Wsend me the data.
DEBUG [com.enterprisedt.net.ftp.FTPClient] 23 Jun 2006 20:52:42.711 : Transferred 308839202 bytes to remote host
DEBUG [com.enterprisedt.net.ftp.FTPControlSocket] 23 Jun 2006 20:52:42.713 : 226 File receive OK.
**********************************************************************************************************
Did i miss anything in the code .??. Appreciate your help .
Thanks,
Krish