Reference Manual |
NAME
tcl - Tcl 6.7 Tool Command Language interpreter, with extensionsSYNOPSIS
tcl [filename]DESCRIPTION
This NAT32 adaptation of John Ousterhout's Tool Command Language supports many features of TCL as described in "Tcl and the Tk Toolkit" (Addison-Wesley 1994).NOTESTcl can be invoked from the NAT32 shell with an argument specifying the filename of a Tcl Script.
Tcl can also be invoked by simply entering a filename directly to the shell, if that file contains the string #!tcl in its first line. Arguments are passed as expected.
Not all of the Tcl exec and open options have been ported.SNMP EXTENSIONS
SNMP Tcl commands are:TCP EXTENSIONSsnmp agentAn agent must first be specified, either as a domain name or as an IP address. A list of object names (or object IDs) can then be specified. For example:
snmp next
snmpsnmp agent nat32.box
snmp system.sysUpTime
snmp next
TCP support consists of a socket command for creating a socket object. Two variants exist, the first for creating a passive socket, the second for creating an active socket:SEE ALSOsocket -p service [qlen]Each variant returns a socket descriptor which can be used as follows:
socket host portset s [socket -p 8000 1]The above command creates a socket object s which listens at port 8000 and uses a listen queue of length 1.To open a TCP connection to a remote host, the second variant of the socket command is used:
set s [socket nat32.com 80]The above command creates a socket object s which is a TCP connection to port 80 at nat32.com. In both cases, once a socket object has been created, the following methods are supported for using that object:{object} accept # accept an incoming connectionTo close a socket, one deletes the socket object using the standard Tcl rename command:{object} getf fname # copy incoming data to file fname
{object} gets len # read len incoming bytes{object} putf fname # copy file fname to the connection
{object} puts var # write var to connectionrename $s {}A complete example is shown in file httpd, a simple but powerful HTTP server.
httpd, sh, shell, snmp, Tutorial