telnet 'connection reset by peer'

Donnal Walter donnal at donnal.net
Mon Aug 23 18:53:27 CEST 2004


On Windows XP I am able to connect to a remote telnet server from the 
command prompt using:

telnet nnn.nnn.nnn.nnn 23

where nnn.nnn.nnn.nnn is the IP address of the host. But using 
telnetlib, this code returns the traceback that follows:

import telnetlib
host = 'nnn.nnn.nnn.nnn'
tn = telnetlib.Telnet(host, 23)
tn.read_until("Enter device name?")


Traceback (most recent call last):
   File "C:\Python23\Lib\site-packages\mindwrapper\test\telnet.py", line 
4, in ?
     tn.read_until("Enter device name?")
   File "C:\Python23\lib\telnetlib.py", line 316, in read_until
     self.fill_rawq()
   File "C:\Python23\lib\telnetlib.py", line 521, in fill_rawq
     buf = self.sock.recv(50)
socket.error: (10054, 'Connection reset by peer')

Is there some parameter that I need to set in order to connect using the 
telnetlib client? Thanks.

Donnal Walter
Arkansas Children's Hospital





More information about the Python-list mailing list