telnet(n) 2.0.0 telnet "Telnet Client"
telnet - A pure Tcl telnet client
package require Tcl 8.0
package require telnet 2.0.0
This package provides a pure Tcl telnet client. This client is suitable for
interfacing to any standard telnet server. It will automatically handle any
negotiation of telnet options. This client will negotiate the TERM, TSPEED,
and SGA options. It will send DONT or WONT for any other telnet options.
- telnet::open host port
-
This command opens the telnet connection to the host at the specified port.
The host argument can be any value that is valid for the host argument to the
socket command.
This command returns the channel identifier representing the TCP socket. This
channel identifier can be used with fconfigure to set options on the
channel. This identifier should be closed with the normal close
command.
- telnet::read ?-nonewline? channelId numChars
-
This command reads data from the telnet server. Any embedded telnet commands
in the stream are removed, with an appropriate response being sent back to the
server. The -nonewline and numChars arguments are passed to the
underlying read command. The channelId is the channel identifier
returned by a previous call to telnet::open.
- telnet::write channelId string
-
This command takes the data in string, performs any necessary escaping
of telnet commands and sends the processed data to the server. The
channelId is the channel identifier returned by a previous call to
telnet::open.
For an example of how to use this package, see the telnet_test.tcl
file that is part of the tclTelnet distribution. This file implements a
simple interactive telnet client.
telnet::open does not provide any way to pass options to the socket
command. There is no way to open the socket asynchronously or specify the
local address and port.
There is no way to influence the negotiation of telnet options.
socket, read, fconfigure, socket
Copyright (c) 2000-2004 by Todd J Martin <todd.martin@acm.org>