Download-file-using-stream-and-SFTP-protocol - WeOnlyDo Software example code



All

wodCrypt (12)
wodSSH (10)
wodSFTP (23)
wodSSHServer (1)
wodSSHTunnel (11)
wodSSHpackage
wodSFTPdll

wodSSH.NET (10)
wodSFTP.NET (24)
wodFtpDLX.NET (22)
wodWebServer.NET (10)

wodAppUpdate (13)
wodHttpDLX (8)
wodFtpDLX (22)
wodTelnetDLX
wodFTPServer (3)
wodWebServer (10)
wodVPN
wodXMPP (13)
All ** [Visual Basic] ** [C#] ** [VB.NET] **

Download file using stream and SFTP protocol
VB.NET code
Dim wodSFTP1 As New WeOnlyDo.Client.SFTP

'Authenticate with server using hostname, login, password.
wodSFTP1.Hostname = "your_hostname"
wodSFTP1.Login = "your_login"
wodSFTP1.Password = "your_password"
wodSFTP1.Blocking = True  ' Use synchronous connections
wodSFTP1.Connect()

Dim ms As New System.IO.MemoryStream

'After connection with server is successful download the file using memory stream.
wodSFTP1.GetFile(ms, "/home/somefolder/somefile.txt")

'Display content of received memory stream.
Console.WriteLine(System.Text.Encoding.ASCII.GetString(ms.ToArray))
ms.Close()
C# code
WeOnlyDo.Client.SFTP wodSFTP1 = new WeOnlyDo.Client.SFTP();

//Authenticate with server using hostname, login, password.
wodSFTP1.Hostname = "your_hostname";
wodSFTP1.Login = "your_login";
wodSFTP1.Password = "your_password";
wodSFTP1.Blocking = true;   //Use synchronous connections
wodSFTP1.Connect();

System.IO.MemoryStream ms = new System.IO.MemoryStream();

//After connection with server is successful download the file using memory stream.
wodSFTP1.GetFile(ms, "/home/somefolder/testfile.txt");
 
//Display content of received memory stream.
Console.WriteLine(System.Text.Encoding.ASCII.GetString(ms.ToArray()));
ms.Close();