Telnetlib & Term Types

Svha news at svha.demon.co.uk
Fri Nov 19 15:22:27 EST 2004


Greetings

I'd like to do some tweaks on a telnet session as I have no control over
the server side what so ever.

However I cannot correctly negotiate a telnet connection to the server.

I've gone back to basics on the code for simplicity here;

Linux 2.6 : Python 2.3.4
Telnetlib Module - http://www.python.org/doc/2.3.4/lib/module-telnetlib.html

import sys, telnetlib
tn = telnetlib.Telnet("xxx.xxx.xxx.xxx")
tn.mt_interact()

All goes well if I point this code to telnet to 127.0.0.1 (Login etc)

However if I point the code to telnet to the server I get;
Debian GNU/Linux 3.0 xxx.xxx.org
Error opening terminal: network.
Note - telnet from the console to this address works fine.

I have limited knowledge of telnet/terminals however I am beginning to
think that the "server" is trying to negotiate a terminal type
(vt100/vt220 I think) and telnetlib responds incorrectly/not at all.

Any thoughts would be much appreciated / is there a more suitable library
than telnetlib for my purpose?

Many thanks ..... Svha



More information about the Python-list mailing list