Hi.
i have written code for file upload manager using ftp..
it perfectly working with sequence file uploading in single connection..
And i tried to
upload multiple files with parallel processing in a single connection.... but it is not working properly.. i also used thread concept
but single file only transfered and connection refused...
my code here...
//////////////////// main class //////////////////////////////////////////
ftp.connect();
ftp.login();
String [] archivos = new String[100];
File dir = new File("C:\\Files Uploading\\");
archivos = dir.list();
for (int s=0; s<archivos.length;s++)
{
//Start Data Transfer Here
new DataTransfer(archivos[s]).start();
Thread.sleep(1000);
}
/////////////////////// thread class ////////////////////////////////
class DataTransfer extends Thread
{
String FileName="";
String LocalPath="",RemotePath="";
public DataTransfer(String fname)
{
FileName = fname;
LocalPath = "C:\\Files Uploading\\" + FileName;
RemotePath = FileName;
System.out.println(LocalPath);
}
public void run()
{
System.out.println("DataTransfer Started");
/File Transfer Here
try
{
FileInputStream input = new FileInputStream(LocalPath);
Ftp_Client.storeFile(RemotePath,input);
System.out.println("Successfully sent : " + RemotePath);
}
catch (Exception exc)
{
System.out.println(exc.getMessage());
}
System.out.println("DataTransfer Ended");
}
}
otherwise tell me any other alternate way