Im attaching a copy of my source code below. Im sure its something I missed. Thanks :)
----------------------------------
protected void initialise() throws Exception {
try {
if (mFtpClient == null) {
mFtpClient = new FTPClient();
//mFtpClient.setDefaultTimeout(5000);
mFtpClient.connect(mScheduler.m_szRemoteHost,mScheduler.m_nControlPort);
int reply = mFtpClient.getReplyCode();
if(!FTPReply.isPositiveCompletion(reply)){
FtpMain.debug("FTPClient Connection Failed");
FtpMain.debug(mFtpClient.getReplyString());
mFtpClient.disconnect();
}else{
FtpMain.debug("FTPClient Connection Established");
mFtpClient.login(mScheduler.m_szUserName,
mScheduler.m_szPassword);
FtpMain.debug("FTPClient Logged in
["+mScheduler.m_szUserName+","+mScheduler.m_szPassword+"]");
if(!FTPReply.isPositiveIntermediate(reply)){
FtpMain.debug("FTPClient Login Failed");
FtpMain.debug(mFtpClient.getReplyString());
}
mFtpClient.enterLocalPassiveMode();
//mFtpClient.setFileTransferMode(FTP.STREAM_TRANSFER_MODE);
mFtpClient.setFileType(FTP.IMAGE_FILE_TYPE);
}
}
else {
try {
mFtpClient.logout();
mFtpClient.disconnect();
}
finally {
mFtpClient=null;
initialise();
}
}
}
catch (IOException ioe) {
if(ioe instanceof FTPConnectionClosedException){
throw new Exception("Session with Server has
expired:"+ioe.getMessage());
}
throw new Exception(ioe.getMessage());
}
}
//////////////////////
FTP Transfer is done using the following code:
//////////////////////
reply = mFtpClient.cwd(transfer.getRemoteDir());
if(FTPReply.isPositiveCompletion(reply)){
FtpMain.debug("Shifted to Remote
Dir:["+transfer.getRemoteDir()+"]");
for (int i = 0; i < files.length; i++) {
synchronized (mScheduler) {
try {
if(mFtpClient.isConnected()){
String remoteFilePath =
transfer.getRemoteDir() + "/" + files[i].getName();
FtpMain.debug("Shifting Local File to
Remote File :["+remoteFilePath+"]");
java.io.FileInputStream stream = new
java.io.FileInputStream(files[i].getPath());
mFtpClient.storeFile(files[i].getName(), stream);
stream.close();
reply=mFtpClient.getReplyCode();
if(FTPReply.isPositiveCompletion(reply)){
FtpMain.debug("Successfully
Transfered remoteFileName:"+mScheduler.mFtpClient.getReplyString());
mDeleteList.add(files[i]);
}else{
FtpMain.error("Error in
Transfering File:["+mFtpClient.getReplyString()+"]");
}
}
/*reply = mScheduler.mFtpClient.getReplyCode();
if(FTPReply.isPositiveCompletion(reply)){
FtpMain.debug("Successfully Transfered
remoteFileName:"+mScheduler.mFtpClient.getReplyString());
mDeleteList.add(files[i]);
}
*/
}
catch (IOException ioe) {
ioe.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
}
}
}
else {
FtpMain.error("Remote Dir -["+transfer.getRemoteDir()+"] is
Invalid");
}
-----------------------------------------
---------- Original Message ----------------------------------
From: [EMAIL PROTECTED] (Jeffrey D. Brekke)
Reply-To: "Jakarta Commons Users List" <[EMAIL PROTECTED]>
Date: Tue, 18 May 2004 20:34:08 -0500
>
>I don't have any code suitable for emailing, but we are using commons
>net for sending multiple files and haven't had any troubles.
>
>>>>>> On Tue, 18 May 2004 10:09:35 +0400, Newbie Guy <[EMAIL PROTECTED]> said:
>
>> Hi All, Does anyone have a sample program that can send multiple
>> binary files to an FTP Server. Im getting a disconnection as soon as
>> the first file is being pushed. After that the program exits and the
>> other files are left untouched.
>
>> Yours,
>
>> Newbie
>
>> _____________________________________________________________________
>> Participate in 'Send and Win' SMS contest and win exciting prizes.
>> Visit http://www.netpipersms.com for more details.
>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail:
>> [EMAIL PROTECTED]
>
>--
>=====================================================================
>Jeffrey D. Brekke [EMAIL PROTECTED]
>Wisconsin, USA [EMAIL PROTECTED]
> [EMAIL PROTECTED]
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
_____________________________________________________________________
Participate in 'Send and Win' SMS contest and win exciting prizes.
Visit http://www.netpipersms.com for more details.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]