Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 63783 invoked from network); 19 May 2004 08:29:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 19 May 2004 08:29:37 -0000 Received: (qmail 41875 invoked by uid 500); 19 May 2004 08:29:57 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 41755 invoked by uid 500); 19 May 2004 08:29:56 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 41691 invoked by uid 98); 19 May 2004 08:29:55 -0000 Received: from mohdjabbas@netpiper.com by hermes.apache.org by uid 82 with qmail-scanner-1.20 (clamuko: 0.70. Clear:RC:0(209.15.112.238):. Processed in 0.026288 secs); 19 May 2004 08:29:55 -0000 X-Qmail-Scanner-Mail-From: mohdjabbas@netpiper.com via hermes.apache.org X-Qmail-Scanner: 1.20 (Clear:RC:0(209.15.112.238):. Processed in 0.026288 secs) Received: from unknown (HELO netpiper.com) (209.15.112.238) by hermes.apache.org with SMTP; 19 May 2004 08:29:55 -0000 Date: Wed, 19 May 2004 12:30:24 +0400 Message-Id: <200405191230.AA10879326@netpiper.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii From: "Newbie Guy" Reply-To: To: "Jakarta Commons Users List" Subject: Re: [net] problem sending with FTPClient X-Mailer: X-IMSTrailer: __IMail_7__ X-Spam-Rating: hermes.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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: jbrekke@wi.rr.com (Jeffrey D. Brekke) Reply-To: "Jakarta Commons Users List" 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 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: commons-user-unsubscribe@jakarta.apache.org >> For additional commands, e-mail: >> commons-user-help@jakarta.apache.org > >-- >===================================================================== >Jeffrey D. Brekke jbrekke@wi.rr.com >Wisconsin, USA brekke@apache.org > ekkerbj@yahoo.com > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org >For additional commands, e-mail: commons-user-help@jakarta.apache.org > > _____________________________________________________________________ Participate in 'Send and Win' SMS contest and win exciting prizes. Visit http://www.netpipersms.com for more details. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org