RE: Sending Through ^] Through telnetlib

Discussion in 'Python' started by Mahrt, Dallas, Jan 23, 2004.


  1. > "John Abel" <> wrote in message
    > news:mailman.687.1074866920.12720.python-> ...
    > >

    > I have written a script that makes a
    > telnet connection, runs various
    > > commands, and returns the output. That was the easy bit :)

    > However, to
    > > close the session, I need to send ^] followed by quit. I've tried
    > > sending chr(29), which is the ascii equivalent, but that

    > doesn't seem to
    > > work. Is there something I'm missing?
    > >
    > > Any pointers would be much appreciated.
    > >
    > > Thanks
    > >
    > > J
    > >

    >


    FYI the telnetlib (as of 2.2.1, not sure past that) does not support all
    telenet commands. If you want to send a special command, you need to access
    the raw socket and send the extened options list character and the command
    character.

    Ex: to send a Telnet BREAK

    telnetCon.get_socket().send(chr(255)+chr(243))

    So maybe trying
    telnetCon.get_socket().send(chr(255)+chr(29))

    Will work fo you?

    ---
    Dallas S. Mahrt>
     
    Mahrt, Dallas, Jan 23, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. walala
    Replies:
    2
    Views:
    1,905
    Francis Avila
    Nov 12, 2003
  2. =?gb2312?B?1cXWvsP3?=

    quest about telnetlib

    =?gb2312?B?1cXWvsP3?=, Nov 13, 2003, in forum: Python
    Replies:
    1
    Views:
    295
    GrayGeek
    Nov 13, 2003
  3. John Abel

    Sending Through ^] Through telnetlib

    John Abel, Jan 23, 2004, in forum: Python
    Replies:
    2
    Views:
    375
  4. Stephen Ferg

    Need help with telnetlib flakiness

    Stephen Ferg, Feb 4, 2004, in forum: Python
    Replies:
    1
    Views:
    361
    Stephen Ferg
    Feb 6, 2004
  5. Mike Monaghan

    telnetlib close not closing sockets

    Mike Monaghan, Sep 22, 2004, in forum: Python
    Replies:
    4
    Views:
    1,274
    Mike Monaghan
    Oct 7, 2004
Loading...

Share This Page