telnetlib

Timothy Grant tjg at exceptionalminds.com
Sat Jul 29 18:28:00 EDT 2000


Hi all,

I have my first need to play with the telnetlib module, and am having some
good successes, but some puzzling failures. I'm hoping that someone here can
shed some light on what's happening.

First the trace from my telnet session:

Telnet(host.abcde.com,23): recv '\015\012SFW 123.123.123.123\015\012'
Telnet(host.abcde.com,23): recv '\024\005'
Telnet(host.abcde.com,23): send 'ABCDEFGH'
Telnet(host.abcde.com,23): recv 'Welcome to Stellar 3\015\012ABCDEFGHI
\015\012'
Telnet(host.abcde.com,23): recv '\015\000\015\000Enter Public ID: '
Telnet(host.abcde.com,23): send 'XYZ\012'
Telnet(host.abcde.com,23): recv 'X'
Telnet(host.abcde.com,23): recv 'YZ\015\012'
Telnet(host.abcde.com,23): recv '\015\000\015\000Enter Private ID: '
Telnet(host.abcde.com,23): send '1234567\012'
Telnet(host.abcde.com,23): recv '*'
Telnet(host.abcde.com,23): recv '*'
Telnet(host.abcde.com,23): recv '*****\010 \010\010 \010\010 \010\010
\010\010 \010\010 \010\010 \010\015\012'
Telnet(host.abcde.com,23): recv '\015\012'
Telnet(host.abcde.com,23): recv 'You have Personal and General mail.\015\012'
Telnet(host.abcde.com,23): recv '\015\012Enter Terminal Type ( PIC default -
? for valid '
Telnet(host.abcde.com,23): recv 'types): '
Telnet(host.abcde.com,23): send 'XTERM\012'
Telnet(host.abcde.com,23): recv 'X'
Telnet(host.abcde.com,23): recv 'T'
Telnet(host.abcde.com,23): recv 'ERM'

Now the code:

host = telnetlib.Telnet(hostname)

host.set_debuglevel(255)

host.read_until('\024\005')
host.write(answerback)

host.read_until('Public ID: ')
host.write(username + '\n')

host.read_until('Private ID: ')
host.write(password + '\n')

host.read_until('): ')		#Set the terminal Type
host.write('XTERM\n')

#My code stops function at this point

#The following prompt never appears
host.read_until('): ')		#Set the terminal Rows
host.write('24\n')

Now the problem.

Everything works great until I enter the Terminal type. It appears that the
telnet session stops receiving at that point. As you can see from the
Traceback I receive the echo of from my write, but then don't receive the
next prompt.

I'm guessing it has something to do with either changing the terminal type
on telnetlib, or a timing issue, but I'm stumped at the moment.

One other point, even if I go with the default terminal type, I have the
same problem.

Any suggestions will be greatfully accepted.

Thanks.

-- 
Stand Fast,
    tjg.

Timothy Grant                         tjg at exceptionalminds.com
Chief Technology Officer              www.exceptionalminds.com
Red Hat Certified Engineer                      (503) 246-3630
Avalon Technology Group, Inc.               fax (503) 246-3124
>>>>>>>>>>>>Linux...Because crashing isn't normal<<<<<<<<<<<<<





More information about the Python-list mailing list