PowerTCP Telnet for .NET
from $349.00Available Platforms
See all PowerTCP Telnet for .NET Code Examples
Automated Session Example
The following example demonstrates an automated Telnet session, with the returned data written to console.
Telnet telnet1 = new Telnet();
telnet1.Connect("myServer");
telnet1.Login(new Credentials("myUsername", "myPassword", "$");
//Send a list command
telnet1.Write("ls -la\r");
//Read until prompt, write to console
string listing = telnet1.ReadToDelimiter("$");
Console.Write(listing);
//Send an exit command; server will close the connection
telnet1.Write("exit\r");
//Read any remaining data before the shutdown and write to console
Console.Write(telnet1.ReadToEnd();
To download a trial please visit the PowerTCP Telnet for .NET product page.