using System; using Jscape.Telnet; namespace SessionExample { public class TelnetExample { public TelnetExample(string hostname){ // Create new telnet session TelnetSession session = new TelnetSession(hostname); // Connect to TELNET server using username and password session.Connect("username", "password"); // Send command to TELNET server session.Send("ls -al"); // Terminate TELNET session without waiting for shell prompt. session.SendNoWait("exit"); // Disconnect session.Disconnect(); } public static void Main() { // Create new TelnetExample instance passing TELNET server hostname or IP address TelnetExample example = new TelnetExample("telnet.server.com"); } } }