telnetlib close not closing sockets

Yannick Turgeon nobody at nowhere.com
Thu Sep 23 01:02:43 CEST 2004


Hello Mike,

Your subject remembered me some hard time using telnetlib on Windows. Oh God
I searched for answers!:o) I would be very happy to prevent you this. To
verify if you have the same problem, Could you tell me if you always reach
the timeout (5 secs) before your read_until() return? 

For your current problem. Did you try with parenthesis after "close": 
tn.close()

I hope it was just that! 

Yannick

Mike Monaghan wrote:
> HOST = "fred"
> tn = telnetlib.Telnet(HOST)
> tn.write("DEMO\n")
> print tn.read_until("\n>",5)
> tn.write("OFF\n")
> print tn.read_until("Logon Please:",5)
> print tn.read_until("make sure socket queue is empty the hard way",5)
> tn.close
> 
> I've tried several options to accomplish this, but for whatever reason
> the socket remains open until I exit python.  



More information about the Python-list mailing list