Re: telnetlib close not closing sockets

From: Mike Monaghan (junkmail_at_chipworks.net)
Date: 09/23/04


Date: 23 Sep 2004 12:30:10 -0700

Yannick,

The parenthesis after the tn.close() did the trick. I know I've made
that mistake somewhere else. Telnetlib's documentation even clearly
says .close() and I bet they mean the () is required. Thank you!!!

As for read_until, I'm not reaching timeout there. I am however
setting a timeout in the statement like so:

  print tn.read_until("\n>",5)

Maybe that change is making it work for me. Did you set a timeout
value when you were testing?

I do have a problem with an expect, but I'm 99% sure a control
character in the stream is missing from my expect statement because
some of the strings are being detected. I'm going to play with it
again tonight.

I have to say I'm much impressed with the python language,
documentation, and community. It will take a while to understand some
of the doc as they are written in a very technical manner. I
personally think its great because most software efforts are plagued
by poor documentation. So far all my problems have been my own.

Thanks again for your help!

Mike

Yannick Turgeon <nobody@nowhere.com> wrote in message news:<nwn4d.19601$pA.1328640@news20.bellglobal.com>...
> 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.



Relevant Pages

  • Re: Introducing a Win2003 server into Win2k environment
    ... > server a DC and will also be installing Exchange 2003 on ... There is lots of documentation about upgrading from 2000 to 2003 Domains ... Mike Brannigan ...
    (microsoft.public.windows.server.setup)
  • Re: rs232 -help!
    ... Okay, I never really found out how to set the comm timeout, however I got it ... I can read the port and the Read functon ... rs232 port asides from using the SerialWnd class.... ... posts from everyone, and then I read over the rs232 documentation, and then I ...
    (microsoft.public.vc.language)
  • Re: non data ware grid?
    ... functionality, but how to leverage that functionality to achieve the results ... documentation may well be better), and it may well be a whole new ball game. ... But I was simply expressing some frustrations I had when using the product, ... mainly because Mike obviously experienced many of the same frustrations. ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: setting socket connect timeout
    ... I am trying to write some production code based on: ... Does anyone know how to change the timeout? ... My documentation is quite old but it did contain a statement about timeouts just ...
    (comp.os.vms)
  • Re: Setting based 1 Arrays
    ... I'm not sure how that's my fault mike :-) ... The documentation is extremely clear. ... Ok, let me see mike. ... seems to me that that array is zero based. ...
    (microsoft.public.dotnet.languages.vb)