Telnet connection

Mike Johnson afp_randjohnson at yahoo.com
Wed Feb 27 04:37:39 EST 2002


"Riss Nicolas" <alien275 at libertysurf.fr> writes:

> I jave used it but when y tried to connect it makes an error:
>    File "c:\test.py", line 9, in ?
>     tn = telnetlib.Telnet("192.168.0.9",32)
>   File "C:\PROGRA~1\python22\lib\telnetlib.py", line 190, in __init__
>     self.open(host, port)
>   File "C:\PROGRA~1\python22\lib\telnetlib.py", line 219, in open
>     raise socket.error, msg
> socket.error: (10061, 'Connection refused')
> 
> Programm:
> 
> import getpass
> import sys
> import telnetlib
> password = getpass.getpass()
> tn = telnetlib.Telnet("192.168.0.9",32)
> tn.read_until("Administrator Password : ")
> tn.write(password + "\n")
> tn.write("session\n")
> 
> 
> Where is the mistake ?

Wrong port. Try:

tn = telnetlib.Telnet("192.168.0.9", 23)


- Mike Johnson




More information about the Python-list mailing list