transfer Stream to a remote server (Stream not see (wodSFTP / wodSFTP.NET / wodSFTPdll)
Hi,
I'm trying to use stream and pass it to PutFile method to transmit it to a remote server. But the following exception keeps coming up:
ForwardOnlyEventingReadStream does not support Seek()
Any idea what to do?
Any help would be very much appreciated.
Thank you and hope to hear from you very soon.
Kamal
Re: transfer Stream to a remote server (Stream not
Kamal,
I think Seek is needed in order to determine length of the Stream. But... Hmm.. Perhaps this could be avoided - I have to see about it. Progress event wouldn't fire correctly in such cases, but still would support non-seekable streams. Give us a day to try this out please.
Re: transfer Stream to a remote server (Stream not
Kamal,
can you provide me with one such 'non-seekable' stream for tests? If it's code-able, can you please send it to techsupport@weonlydo.com ?
Re: transfer Stream to a remote server (Stream not
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.
Re: transfer Stream to a remote server (Stream not
I've just noticed that it only transfers 3 files at a time. i've put 10 files, it only transmitted 3 of them. and done it again and transmitted 3 as well...
in the LogFile, it keeps coming up with the following for a while then starts displaying the communication, receive etc..
---------------------------
Connect::start
Connect::BeginConnect
Connect::start
Connect::BeginConnect
Connect:end
Connect:end
Connect::start
Connect::BeginConnect
Connect:end
Connect::start
Connect::BeginConnect
--------------------------
Any idea what that can be?
Thanks
Re: transfer Stream to a remote server (Stream not
Any help, idea, comment and/or suggestion would be very much appreciated.
Re: transfer Stream to a remote server (Stream not
Please download wodSFTP.NET again, I think it will work now. Let me know on your tests.
Re: transfer Stream to a remote server (Stream not
Is it any different to the previous one? how different? what updates have you made to it please? do u think i still need to include the above code as it worked with it fine with no probs...
Anyhow, i've not tried it yet but i will and let you know how it went.
thank you.
Re: transfer Stream to a remote server (Stream not
Kamal,
we changed only minor version so there's no references about fix in release notes. As it is now, it should try to upload non-seekable streams. We couldn't throughly test it, but what we've tested it worked ok.