PowerTCP SSH and SFTP for .NET

from $349.00
Available Platforms

Receive and Display Data Code Example

See all PowerTCP SSH and SFTP for .NET Samples and Code Examples

 

The following example demonstrates receiving session data and outputting it to the console.

 

Ssh ssh1 = new Ssh();
ssh1.Connection.RemoteEndPoint.HostNameOrAddress = "mySFtpServer.com";
ssh1.Connect();
SshLoginData loginDetails = new SshLoginData();
loginDetails.Username = "myUsername";
loginDetails.Password = "myPassword";
ssh1.Authenticate(loginDetails);
//Start a session
SessionStream session = ssh1.StartShell();
byte[] buf = new byte[1024];
Data readData = session.Read(buf);
//If readData.Count is 0, the connection has been closed.
if (readData.Count == 0)
    return;
Console.Write(readData.ToString());

 

To download a trial please visit the PowerTCP SSH and SFTP for .NET product page.