I am creating a memory stream on run time
var stream = new MemoryStream();
var writer = new StreamWriter(stream);
writer.WriteLine("There could by any text over here....");
writer.Flush();
stream.Position = 0;
Now i want to transfer this memory stream via SSH library to a remote SFTP server and want to save it on that SFTP server.
I have tried following code but its not working
using (var scp = new ScpClient("HostName", "test", "test"))
{
scp.Connect();
scp.Upload(stream, "/Files/Test/temp.txt");
scp.Disconnect();
}
it get stuck forever on following line without any error
scp.Upload(stream, "/Files/Test/temp.txt");
Can any one please help?