Resolving telnet or rlogin problems

These explanations can be useful in solving problems with the telnet or rlogin command.

If you are having trouble with screen distortion in full-screen applications:

  1. Check the TERM environment variable by issuing one of the following commands:
    echo $TERM
  2. Verify that the TERM variable is set to a value that matches the type of terminal display you are using.

telnet subcommands that can help in debugging problems include:

Item Description
display Displays set and toggle values.
toggle Toggles the display of all network data in hex.
toggle options Toggles the display of internal telnet process options.

If the inetd daemon could execute the telnet service but you still cannot connect using the telnet command, there may be something wrong with the telnet interface.

  1. Verify that telnet is using the correct terminal type.
    1. Check the $TERM variable on your machine:
      echo $TERM
    2. Log in to the machine to which you are trying to attach and check the $TERM variable:
      echo $TERM
  2. Use the telnet interface's debugging capabilities by entering the telnet command without flags.
    1. Type open host where host is the name of the machine.
    2. Press Ctrl-T to get to the tn%gt; prompt.
    3. At the tn> prompt, type debug for debugging mode.
  3. Try to connect to another machine using the telnet interface:
    telnet bastet
    Connected to bastet
    Escape character is '^T'.
    Watch the display as the various commands scroll up the screen. For example:
    SENT do ECHO
    SENT will TERMINAL TYPE (reply)
    SENT will SUPPORT SAK (reply)
    RCVD do TERMINAL TYPE (don't reply)
    RCVD will ECHO (don't reply)
    RCVD will SUPPRESS GO AHEAD (don't reply)
    RCVD wont SUPPORT SAK (reply)
    SENT dont SUPPORT SAK (reply)
    RCVD do SUPPORT SAK (don't reply)
    SENT suboption TELOPT_NAWS Width 80, Height 25
    RCVD suboption TELOPT_TTYPE aixterm
  4. Check /etc/termcap or /usr/lib/terminfo for the aixterm definition. For example:
    ls -a /usr/lib/terminfo
  5. If the aixterm definition is missing, add it by building the ibm.ti file. For example:
    tic ibm.ti
    The tic command is a terminal information compiler.

Problems with function and arrow keys can arise when using the rlogin and telnet commands with programs using extended curses. Function and arrow keys generate escape sequences, which are split if too little time is allotted for the entire key sequence. Curses waits a specific amount of time to decide whether an Esc indicates the escape key only or the start of a multibyte escape sequence generated by other keys, such as cursor keys, the action key, and function keys.

If no data, or data that is not valid, follows the Esc in the allotted amount of time, curses decides that the Esc is the escape key, and the key sequence is split. The delay resulting from the rlogin or telnet command is network dependent. Sometimes arrow and function keys work and sometimes they do not, depending on the speed of the network to which you are connecting. Setting the ESCDELAY environment variable to a large value (1000 to 1500) effectively solves this problem.