[Twisted-Python] Telnet negotiation with Twisted

Lee Orsino lmorsino at gmail.com
Thu Dec 1 19:12:51 EST 2011


Hi all,

I'm writing a twisted Telnet server and I want a client to be able to
connect to it through some other interface, such as PuTTY.  I can make the
connection fine. But one of my requirements is to be able to tell the
client to switch back and forth between buffered and unbuffered input modes
depending on the state of the server. (Sometimes, the client should enter
text, then hit enter to send. Other times, the client should send data
character-by-character).

I'm new at this, and maybe I'm missing something, but in my TelnetTransport
object, I do something like this to disable buffering of client data:

self.transport.write(IAC + WILL + LINEMODE)
self.transport.write(IAC + SB + LINEMODE + MODE + chr(0) + IAC + SE)

Not working though. PuTTY still requires me to hit <enter> after I type.
I've tried various combinations of the above. I'm sure I'm doing something
wrong but its just really hard to find an example of this on the net. I'd
appreciate some advice as to how to proceed, or a simple example if you
have time...

I'm using the twisted Telnet classes found here:
http://twistedmatrix.com/trac/browser/tags/releases/twisted-8.2.0/twisted/conch/telnet.py

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20111201/0dfffd0d/attachment.htm 


More information about the Twisted-Python mailing list