<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I haven't worked with the telnet protocol since the 1.x series honestly and I remember having to add a good bit of code to support all the control functions in order to get things working as nicely as I wanted. That aside, echo (or lack thereof) did work fine, but "will" will not force a client to do anything. I believe you need to use "do"/"dont" to get the effect you desire.<br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div><br class="Apple-interchange-newline">--<br>James Tanis<br>Technical Coordinator<br>Computer Science Department<br>Monsignor Donovan Catholic High School</div><div><br></div></span><br class="Apple-interchange-newline">
</div>
<br><div><div>On Nov 16, 2009, at 9:14 AM, <a href="mailto:filoufake-python@yahoo.fr">filoufake-python@yahoo.fr</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hello,<br><br>Some month ago, exarkun helped me in the development of a very simplified<br>telnet server.<br><br>I observed that when I connect from a windows client, the LOCALECHO<br>is set to "OFF" after the authentication. I cannot set it "ON"<br>afterwards. Everything typed in the client console is hidden.<br>When I use a linux client, the "ECHO" is OFF just for typing the <br>password and then ON again.<br><br>Does someone has an idea how to do with the windows client?<br>I tried to set the ECHO ON using self.transport.will(ECHO) but that<br>doesn't work.<br><br>Here is the code:<br><br>############################################################<br>import sys<br>from zope.interface import implements<br>from twisted.internet import protocol<br>from twisted.python import log<br>from twisted.cred import error<br>from twisted.cred import portal<br>from twisted.cred import checkers<br>from twisted.cred import credentials<br>from twisted.conch.telnet import AuthenticatingTelnetProtocol<br>from twisted.conch.telnet import StatefulTelnetProtocol<br>from twisted.conch.telnet import ITelnetProtocol<br>from twisted.conch.telnet import TelnetTransport<br>from twisted.conch.telnet import ECHO<br><br>class Realm:<br> &nbsp;implements(portal.IRealm)<br><br> &nbsp;def requestAvatar(self, avatarId, mind, *interfaces):<br> &nbsp;&nbsp;&nbsp;if ITelnetProtocol in interfaces:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;av = MyTelnet()<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;av.transport.will(ECHO)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;av.state = 'Command'<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return ITelnetProtocol, av, lambda:None<br> &nbsp;&nbsp;&nbsp;raise NotImplementedError("Not supported by this realm")<br><br>class MyTelnet(StatefulTelnetProtocol):<br> &nbsp;def telnet_Command(self, line):<br> &nbsp;&nbsp;&nbsp;print "line received via telnet", line<br> &nbsp;&nbsp;&nbsp;self.sendLine('coucou man, you send me %s' % line)<br><br>def main():<br> &nbsp;r = Realm()<br> &nbsp;p = portal.Portal(r)<br> &nbsp;c = checkers.InMemoryUsernamePasswordDatabaseDontUse()<br> &nbsp;c.addUser("AA", "aa")<br> &nbsp;p.registerChecker(c)<br> &nbsp;p.registerChecker(checkers.AllowAnonymousAccess())<br> &nbsp;f = protocol.ServerFactory()<br> &nbsp;f.protocol = lambda: TelnetTransport(AuthenticatingTelnetProtocol, p)<br> &nbsp;log.startLogging(sys.stdout)<br> &nbsp;from twisted.internet import reactor<br> &nbsp;reactor.listenTCP(4738, f)<br> &nbsp;reactor.run()<br><br>if __name__ == '__main__':<br> &nbsp;main()<br>############################################################<br><br>Best Regards,<br>Philippe<br><br><br><br><br>_______________________________________________<br>Twisted-Python mailing list<br><a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python<br></div></blockquote></div><br></body></html>