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

iPod shuffle offer

For a limited time get the newly re-designed iPod shuffle free with qualifying purchase.

Click for details.


News

Secure iNet Factory 8.0 Released
04/04/2008 02:24 PM

Updates to Email Factory for .NET and Secure iNet Factory
03/29/2008 04:06 PM

JSCAPE Secure FTP Server 3.9 Preview
03/14/2008 12:19 PM

AnyClient Service and Application Launched
03/12/2008 03:41 PM

JSCAPE Secure FTP Server 3.8 Released
02/12/2008 10:50 AM


Tutorials

Email Validation with Java
04/15/2008 02:04 PM

Sending HTML Based Email Using Java
03/11/2008 02:47 PM

Secure FTP Using Java and FTPS (FTP over SSL)
03/10/2008 04:08 PM

FTP Directory Listing Using Java
03/10/2008 03:57 PM

Sending Email Using Java
03/09/2008 03:43 PM

SSH Using Java
03/09/2008 02:53 PM


Articles

DMZ File Transfer Streaming
03/28/2008 11:57 AM

Phishing looks to FTP to distribute malware
03/13/2008 05:14 PM

Ad Hoc File Transfer Explained
03/13/2008 09:16 AM

Password Policies Made Easy
03/12/2008 03:03 PM


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