commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sundararajan Govindarajan" <SundararajanGovindara...@JohnDeere.com>
Subject Problem while trying to write multiple files using FTPClient
Date Mon, 13 Oct 2003 18:39:50 GMT
Hi 
Iam trying to write two files as part of my transaction into a ftp server. I dont have the
physical file in my local system and i only have the contents. So iam opening a connection
stream to the ftp server using the method ftpClient.storeFile (remotefilename). I am successful
in opening the first outputstream but my program hangs when it tries to open the second outputstream.
This is the code iam using,


		String txnFileName = "txn1";
		String txnIsDoneFile = "txn1.ISDONE";
		String keywordContents = "Transcation contents";
		String isDoneContents = "ISDONE contents";
		try {
			OutputStream firstOutputStream = ftpClient.storeFileStream (txnFileName);
			OutputStream secondOutputStream = ftpClient.storeFileStream(txnIsDoneFile);

			DataOutputStream firstDataOutputStream = new DataOutputStream (firstOutputStream);
			firstDataOutputStream.writeBytes (keywordContents);
			firstDataOutputStream.close();

			DataOutputStream secondDataOutputStream = new DataOutputStream (secondOutputStream);
			secondDataOutputStream.writeBytes(isDoneContents);
			secondDataOutputStream.close();
			
		}
		catch (Exception exp){
			exp.printStackTrace();
		}


I tried to open the second ouputstream after closing the first ouputstream. It always returned
a null in that case.

any help in this regard will be greatly appreciated.

thankyou
govind


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message