How are you running it?This usually happens when you have an error in your
connection, and then you try to re-run it, and the previous connection
attempt has not released the port yet.
Are you having an error between subsequent runs, or do you have an error the
first time you run it after a fresh reboot?

On Wed, Aug 19, 2009 at 6:32 AM, Rayon <evosw...@hotmail.com> wrote:

>  using python telnet lib to connect to a Nortel switch, and dump some
> tables.
> My problem is that every now and then the connection is reset by peer .
> Telnet Error : (10054, Connection reset by peer)
> I need  to know why, I have it in a loop so it will download after a few
> tries but I need to know why.
> here is the code.
>
>
> #main telnet class
> import telnetlib
>     #import telnet lib
>
> class supertelnet: # super tenet class
>
>
>     def __init__(self): # def construct
>         """"""
>
>     def telNetCall(self, Host, User, Pass, LocalFile):
>         print "start lens dump"
>         host  = Host
>         user  = User
>         password = Pass
>         file = LocalFile
>         telnet  = telnetlib.Telnet(host) # connect to telnet client
>         #telnet.set_debuglevel(1)
>         telnet.read_until('Enter User Name', 3) # read session data untill
> match or timeout.
>         telnet.write(user + '\r') # send username
>         telnet.write(password + '\r') #send password
>         # send command to dump len files
>         # start
>         print "lens dump in progress"
>         telnet.write('table ibnlines' + '\r')
>         telnet.write('format pack' + '\r')
>         telnet.write('list all' + '\r')
>         telnet.write('logout' + '\r')
>         #end of commands
>         lens =  telnet.read_all() # get session data and store data
>         print "file write strated"
>         x = open(file,'wd') # open file
>         x.write(lens) # write data to file
>         print "file done"
>
> <http://www.python-forum.org/pythonforum/viewtopic.php?f=5&t=5743&start=0&sid=1b6f1dccdacd2e494924c12af818b59b#p25108>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to