Telnet .NET Component
Home Search Knowledge Base Support

Support

Click here for access to live sales support.

For technical support please submit a ticket to the Help Desk.

 

Java and .NET Help

iTunes Gift Card Offer

For a limited time get a $50.00 iTunes gift card free with qualifying purchase.

Click for details.


News

JSCAPE launches Employee Giving Program
07/03/2010 08:26 AM

SSH Factory 3.6 Released
07/03/2010 06:22 AM

Secure iNet Factory 8.5 Released
07/03/2010 06:07 AM

Secure FTP Factory 8.5 Released
07/03/2010 06:03 AM

Secure FTP Applet 6.2 Released
06/10/2010 02:23 PM

JSCAPE Secure FTP Server 6.6 Released
06/10/2010 02:03 PM

more...


Tutorials

Enabling Phone Authentication
04/08/2009 11:24 AM

Detecting and Handling Brute Force Password Attacks
01/29/2009 09:44 AM

Creating a Domain
12/15/2008 11:33 AM

Public key authentication with SFTP
10/02/2008 07:59 AM

Formatting MimeMessages using .NET
09/14/2008 04:31 PM

Communicating with an IMAP4 server in .NET
09/14/2008 03:54 PM

more...


Articles

Access vital corporate documents on the go
07/01/2010 02:15 PM

SFTP and Encryption
05/17/2010 09:52 PM

Streamlining web uploads with ZIP archives
12/14/2009 10:11 AM

Using regular expressions in complex trigger conditions
09/08/2009 07:42 AM

Using custom forms to automate business processes
07/03/2009 08:51 AM

Public key authentication with SFTP
10/02/2008 07:59 AM

more...


Feedback

Request a feature or component

Request a Java or .NET component


 

Telnet .NET Component

The Telnet .NET Component provides easy to use client implementations for Telnet, rlogin, rsh and rexec protocols.

download telnet factory for .netpurchase telnet factory for .net

Features

  • Scripting API - Easy to use API providing automation of telnet tasks.
  • Regular expression support - Define complex tasks using regular expressions.
  • All major components - Includes Telnet, Rexec, Rsh and Rlogin components.
  • RFC compliant - Fully compliant with RFC 854 and RFC 855.


Code Example

The following C Sharp example demonstrates an interactive session using the Telnet .NET component.

/*
 * TelnetExample.cs
 *
 * Copyright (c) 1999-2005 JSCAPE, LLC
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JSCAPE ("Confidential Information"). You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JSCAPE.
 */
using System;
using System.IO;
using System.Text;
using System.Threading;
using Jscape.Telnet;

namespace TelnetExample {

   public class TelnetExample {

      public bool connected = false;
      public Telnet myTelnet = null;

      public TelnetExample(string hostname){
         // Instantiate Telnet
         myTelnet = new Telnet(hostname);

         // Subscribe to connection events
         myTelnet.ConnectedEvent += new Telnet.ConnectedEventHandler(OnConnected);
         myTelnet.DisconnectedEvent += new Telnet.DisconnectedEventHandler(OnDisconnected);

         // Subscribe to option events. In this example, refuse all options.
         myTelnet.DoOptionEvent += new Telnet.DoOptionEventHandler(OnDoOption);
         myTelnet.DontOptionEvent += new Telnet.DontOptionEventHandler(OnDontOption);
         myTelnet.WillOptionEvent += new Telnet.WillOptionEventHandler(OnWillOption);
         myTelnet.WontOptionEvent += new Telnet.WontOptionEventHandler(OnWontOption);

         // Subscribe to data received event
         myTelnet.DataReceivedEvent += new Telnet.DataReceivedEventHandler(OnDataReceived);

         // Connect to telnet server
         myTelnet.Connect();
         this.Connected = true;

         // Begin reading and writing data to telnet server
         TelnetOutputStream output = myTelnet.GetOutputStream();
         string input = "";
         while ((input = Console.ReadLine()) != null) {
            if ((this.Connected) && (input != "exit")) {
               ((TelnetOutputStream) output).PrintLn(input);
            } else {
               break;
            }
         }

         // Disconnect from telnet server
         myTelnet.Disconnect();
      }

      public bool Connected {
         get {
            return connected;
         }
         set {
            connected = value;
         }
      }

      public static void Main() {

         Console.Write("Telnet server: ");
         string hostname = "";
         if ((hostname = Console.ReadLine()) != "") {
            TelnetExample telnetexample = new TelnetExample(hostname);
         }
      }

      public void OnConnected(object sender, TelnetConnectedEventArgs e) {
         Console.WriteLine("Connected to {0}:{1}", e.Host, e.Port);
      }
      public void OnDisconnected(object sender, TelnetDisconnectedEventArgs e) {
         this.Connected = false;
         Console.WriteLine("Disconnected.");
      }
      public void OnDoOption(object sender, TelnetDoOptionEventArgs e) {
         myTelnet.SendWontOption(e.Option);
      }
      public void OnDontOption(object sender, TelnetDontOptionEventArgs e) {
         myTelnet.SendDontOption(e.Option);
      }
      public void OnWillOption(object sender, TelnetWillOptionEventArgs e) {
         myTelnet.SendDontOption(e.Option);
      }
      public void OnWontOption(object sender, TelnetWontOptionEventArgs e) {
         myTelnet.SendWontOption(e.Option);
      }
      public void OnDataReceived(object sender, TelnetDataReceivedEventArgs e) {
         Console.Write(myTelnet.Encoding.GetString(e.Data));
      }
   }
}

download telnet factory for .netpurchase telnet factory for .net