Tcl API Reference -- ns_cport

### ns_cport

#### Overview

Control port interface commands

#### Syntax

ns_cport auth login password

ns_cport channel

ns_cport db ?pool?

ns_cport echo on | off

ns_cport exec command

ns_cport initcmds

ns_cport inputrc login

ns_cport isauth

#### Description

ns_cport auth authenticates the specified login/password combination and returns an error if it is invalid.

ns_cport channel returns the name of the Tcl channel associated with the control port. For example:

        proc get_name { } {
          set channel [ns_cport channel]
          puts $channel "Enter your name."
          gets $channel username
          puts $channel "Hello, $username"
        }

The above example would then allow the following interaction over the control port:

        server1> get_name
        Enter your name.
        George
        Hello, George
        server1>

ns_cport db allows you to enter DB mode, meaning you can enter SQL commands instead of Tcl commands in the control port interface. If a pool is specified, the control port will begin interpreting commands as SQL commands. SQL commands must be terminated with a semicolon and may span more than one line. To exit DB mode and begin entering Tcl commands again, enter a semicolon by itself. If no pool is specified, a list of available database pools and their descriptions is displayed.

ns_cport echo turns echoing on or off. It is used only in conjunction with:

        gets [ns_cport channel]

ns_cport exec runs the specified command in the control port. For example:

        ns_cport exec "tail -f log/server.log&"

ns_cport initcmds returns the value of the InitCmds configuration file parameter.

ns_cport inputrc returns the path to the inputrc file for the specified username (login).

ns_cport isauth determines if the user has already logged into the control port. It returns 1 if the user is authorized and 0 if not.

Top of Page
Copyright © 1998-99 America Online, Inc.