Re: transfer Stream to a remote server (Stream not - WeOnlyDo Discussion board

Re: transfer Stream to a remote server (Stream not (General questions)

by Kamal, Friday, January 07, 2005, 16:56 (7057 days ago) @ wodSupport

The PutFile method is trying to seek the stream passed to it. However, The stream produced by the xml assembler which is not necessarily seekable!!

so Is there anyway we can stop PutFile from seeking the Stream?

So what've done is creating a VirtualStream and pass it the method, the snapshot of the code is as follows:
-----------------------------------------------
s Stream = new Stream(); (s is assigned some values from an xml msg.)

------------------------------------------------

VirtualStream rs = new VirtualStream();

XmlTextReader XmlDataRdr = new XmlTextReader(s);
XmlTextWriter XmlDataWrtr = new XmlTextWriter(rs,null);
XmlDataWrtr.WriteNode(XmlDataRdr, false);
XmlDataWrtr.Flush();

ResponseStream.Seek(0,SeekOrigin.Begin);
-------------------------------------------------------

I initially tried to use seak for the Stream but it wouldn't work. However, when using the virtual stream, it worked perefectly.

One question though, the server is passing a multiple streams, i.e. many file, lets say 100 to 1000 files. the streams keeps firing the method which includes the following:
SFTP sftp = new SFTP();
sftp...properties assigned here such sftp.RemotePath etc..
.....
sftp.Connect();
sftp.PutFile(stream, RemotePath);
sftp.Disconnect();

Is this the correct way of going about sending multiple files/Streams? or it seems like repeating the process of each single file/stream?

is there any other way of sending multiple files without having to initialise and connect over and over again?!

does the above process affect the performance?

Thank you and hope to hear from you very soon.


Complete thread: