On 24 Aug, 11:07 pm, filoufake-pyt...@yahoo.fr wrote: >Thank you Jean-Paul for replying, > >I still have some things that I don't understand: > >If I put your piece of code in my factory's protocol, I can connect to >the server but as soon as I enter the username, I got the an error >message telling that Server doesn't support "will" ('Server' object has >no attribute 'will').
That means you've hooked up a telnet protocol to a tcp transport, rather than a telnet transport. The telnet transport sits between these two things and adds features like "will" negotiation; it also is in charge of actually interpreting telnet command sequences received from the network and turning them into calls onto your telnet protocol instance. Without the telnet transport, the telnet protocol just gets raw data. >[snip] > >I understand that this has something to do with TelnetTranport but how >to implement it? >I read the telnet_echo.tac but in my case I have to manage the portal >also and that is a litle bit too complex for me. If necessary, you can pass arguments to your telnet protocol. telnet_echo.tac uses "lambda: TelnetTransport(TelnetEcho)" as its protocol. If TelnetEcho took an argument to __init__, though, you could supply it by using this as your protocol instead: "lambda: TelnetTransport(TelnetEcho, foo)". Does that help? > >You say also that AuthenticatingTelnetProtocol expects to be connected >to an ITelnetTransport, but the documentation says "When the >information is collected, it is passed to a portal and an avatar >implementing ITelnetProtocol is requested". >I'm lost. AuthenticatingTelnetProtocol is an ITelnetProtocol implementation. So, it needs to be hooked up to an ITelnetTransport implementation, as all ITelnetProtocol implementations need to. However, since the only thing it knows how to do is handle authentication, it also wants to get /another/ ITelnetProtocol implementation out of the portal you give it. After authentication succeeds, that new ITelnetProtocol implementation will be given control of the connection and the AuthenticatingTelnetProtocol will get out of the way. So you end up with one telnet transport and two telnet protocols. Jean-Paul _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python