GetFile Stream Problem (wodSFTP / wodSFTP.NET / wodSFTPdll)
Hello,
Whenever I try to use GetFile(Stream, FileName), after the call, the stream because un-readable (canread/canseek/canwrite = false). When I go into debug mode, as I watch the stream, the length property on the stream ends up saying <Error: System.ObjectDisposedException>.
I need to pass the stream on to another process, so I've been using a memory stream but have tried every other stream under the sun.
Thanks in advance!
Here is a code chunk:
Stream NewMsgStream = new MemoryStream();
//Stream is readable
wodSFTP.GetFile(NewMsgStream, remotePath+(string)transferFiles[0]);
//Stream is now un-readable
Re: GetFile Stream Problem
I tried this simple code and works for me. It does nothing smart, just downloads something to stream and then accesses first 20 bytes. [code] static void Main(string[] args)
{
SFTP s = new SFTP();
s.Blocking = true;
s.Hostname = localhost ;
s.Login = kreso ;
s.Password = test ;
s.Connect();
Stream NewMsgStream = new MemoryStream();
//Stream is readable
s.GetFile(NewMsgStream, /HOME/SOMEFILE.TXT );
NewMsgStream.Position = 0;
byte[] b = new Byte[20];
NewMsgStream.Read(b,0,20);
s.Disconnect();
}[/code]