[Tutor] RE: Sending Break in Telnet

Pankaj Mittal PMittal@Ceon.com
Tue Jan 28 12:59:01 2003


Hi Derrick

You are absolutely correct ^} is just to indicate the telnet client to got
to a mode where some commands can be send like break. I read the RFC
document and came to know about the break sequence. I was unable to send
this as in Python 2.0.1 the telnet class escapes the special character i.e.
decimal 255. So I found that I can directly use the public socket variable
when I need to send this special characters as there is no other write
function in telnet class. So Once I did that I was able to send special
characters and everything worked.

Thanks for you help 

Pankaj
-----Original Message-----
From: Derrick 'dman' Hudson [mailto:dman@dman.ddts.net]
Sent: Monday, January 27, 2003 9:00 PM
To: 'tutor@python.org'
Cc: Pankaj Mittal
Subject: Re: Sending Break in Telnet


On Wed, Jan 15, 2003 at 06:21:54PM -0800, Pankaj Mittal wrote:
| Hi
| 
| I am developing a python program that connects to a server using telnet.
| When I use the unix telnet I have to send 
| telnet <IPAddress> <PortNumber>. This has to be followed by sending a "^]"
| chartacter and then with "send break" on receiving a "telnet>" prompt. 
| But when I try to send \035(equivalent of '^]', it does not work.

How does your python program make the connection?

Typing ^] is specific to the 'telnet' program.  That is merely a way
of indicating that you (the user at the keyboard) want the telnet
program itself to respond to you, rather than sending the keys on to
the remote machine.

| Also I tried to send '\377\363'(255 and 243 - code as in RFC
| document).

I'm not sure, but possibly that character sequence must occur in a
specific location in the telnet data stream.  I'm not familiar with
the intricacies of the telnet protocol and I don't have the RFCs
handy, nor the time at the moment to read through them.  However, I
suspect that if you reread the RFC and if you use a packet sniffer
like tcpdump or ethereal to compare the two sessions you'll find the
difference.  It is completely possible to match the (snipped) example
session using python code and not using the 'telnet' program.

HTH,
-D

-- 
Whoever gives heed to instruction prospers,
and blessed is he who trusts in the Lord.
        Proverbs 16:20
 
http://dman.ddts.net/~dman/