Version: 1.10.2.1
Build terminal emulation capabilities into your application with VT and Telnet controls.

Telnet ActiveX Control

Use the Telnet control to easily integrate Telnet, rsh, rexec and rlogin communications into your application. Features include:

  • Communications can optionally block execution of your program for scripting applications, or high-performance event-driven communications can be selected for interactive applications.
  • Supports automatic option negotiation using properties for terminal type, echo and window size, eliminating the extra step of dealing with option negotiation code.
  • Fully supports sub-option and manual option negotiation for advanced applications.
  • Simple methods to manage rsh, rexec, and rlogin connections.

Looking for the .NET version of this control?

Development Environment

  • Visual Studio .NET (.NET Framework)
  • Visual Basic (VB)
  • Visual C++ (VC++)
  • FoxPro
  • PowerBuilder
  • Delphi
  • C++ Builder
  • ASP
  • Office 97/2000

Interface Members

 

 

Public Properties
AutoOption Enables automatic Telnet option negotiation.
Blocked A True value indicates the control is currently executing a blocking method (Timeout is greater than 0), which has neither completed nor timed out with a ptTimeout error.
Echo Indicates that the remote host should echo all Telnet data it receives back to the client.
KeepAlive When set to True, the KEEPALIVE socket option is set to monitor dropped connections. This option can only be set when the State property is tcpConnected.
LocalAddress When the State property is tcpConnected, LocalAddress returns the address of the local host in dot notation (for example, nnn.nnn.nnn.nnn). When not connected, it returns an empty string.
LocalPort When the State property is tcpConnected, LocalPort returns the port number that the socket is bound to. When not connected, it returns 0.
ReceiveBufferCount Checks for the existence of data without removing it.
Ref Stores a reference to another object, data type, or value.
RemoteAddress Returns the address of the remote host in dot notation (i.e. nnn.nnn.nnn.nnn) when the State property is tcpConnected.
RemotePort Returns the port number of the remote host when the State property is tcpConnected.
SendBufferCount When the Send method is used, some data may be stored in a buffer and later submitted to the system. The Send event fires to indicate that the system has accepted the submitted data.
Socket System identifier assigned to the TCP connection. It is normally used to assume management of an accepted socket from the Daemon Control.
State Provides status information to the user interface. The State event fires to signal that this property has changed.
TermType Specifies the desired terminal type when the AutoOption property is True.
Timeout Controls the blocking behavior of methods that can be used in blocking and non-blocking ways.
WindowSize Specifies the desired window size when the AutoOption property is True.
Public Methods
Abort Abort any blocking method and release all system resources.
About Show the About Box.
Close Close the session and release all system resources. A single control can be used for many connections, one after the other.
Connect Establish a connection. The State property immediately changes to tcpConnecting and changes to tcpConnected when the connection is established. The State Property can be checked in the body of the State event, polled off a timer, or checked immediately after this method is used when a positive Timeout is specified.
Receive Receive an arbitrary amount of data. The specified String or Byte array is filled with bytes from the remote host.
Rexec Uses the remote execute protocol common to UNIX systems, which is intended to execute commands on a remote UNIX host. User and Password must match an account on the remote host.
Rlogin Uses the remote login protocol common to UNIX systems, which is similar to Telnet but simpler. It does not require Telnet option negotiation because it was intended for use between two UNIX systems.
Rsh Uses the remote shell protocol common to UNIX systems, which is intended to execute shell commands on a remote UNIX host. This method differs from the Rexec method (which implements the remote execute protocol) by being faster and not requiring a full login. For full description of the remote shell protocol, see the UNIX man pages.
Search Receive data up to and including a terminating sequence. The data stream is searched for the specified Token, and the specified string, byte array, or DartStream object is filled with the data stream up to and including the specified Token.
Send Send data after a connection is established. The Send event fires when Data is accepted by the system buffers. The SendBufferCount property indicates the number of bytes that have been submitted but have not yet been accepted by the system buffers.
SendCommand Send a Telnet command sequence. The Telnet Control ensures all formatting is accomplished correctly. This method is normally called from within the Command event.
Trace Start or stop the accumulation of trace or debug data. Once started, this method accumulates data until it is turned off.
Public Events
Command When the AutoOption property is set to False, the Telnet Control does not respond to Telnet commands, but instead fires the Command event. The application must have the appropriate code within this event to handle all option negotiation. The presence of this event allows the user to write sophisticated Telnet clients that can support any desired option, as well as Telnet server applications. The SendCommand method is used to send Telnet option negotiation sequences and commands.
Error Fires when an error condition occurs.
Receive Fires when ReceiveBufferCount changes.
Send Fires when the system accepts data for sending.
State Fires when the State property changes.

Code Example

How easy is the Telnet ActiveX component to use? Check out the following VB example below, which demonstrates connecting to a host, issuing a command, receiving the reply, and closing the connection.

Dim Data As String
Dim Count As Long

' Set Timeout to 5000 milliseconds to wait on communications
Telnet1.Timeout = 5000

' establish a connection to a Telnet server
Telnet1.Connect "myhostname"

' wait for login prompt
Count = Telnet1.Search(Data, "Login: ")

' send my Username
Telnet1.Send "user" & vbCrLf

' wait for the password prompt&ldots;
Count = Telnet1.Search(Data, "Password:")

' send my password
Telnet1.Send "mypassword" & vbCrLf

' wait for the shell prompt
Count = Telnet1.Search(Data, "$ ")

' run a report application
Telnet1.Send "myreport" & vbCrLf

' get the report output; terminates with a double line
Count = Telnet1.Search(Data, vbCrLf & vbCrLf)

Text1.Text = Data ' put the report into an text box for viewing

' close the connection
Telnet1.Close