[Twisted-Python] struggling with twisted telnet

Jean-Paul Calderone exarkun at divmod.com
Wed Aug 8 06:32:32 MDT 2007


On Wed, 8 Aug 2007 13:25:59 +0100, Andrew Roden <andrew.roden at gmail.com> wrote:
>Hi
>
>I'm pretty new to python which probably isn't helping, but I'm kind of stuck
>with twisted telnet. I'm trying to build a couple of 'emulators' for some
>simple router/switches just so that you can log on and run some 'standard'
>commands and get a 'standard' output for use elsewhere. I've managed to get
>an SSH version working with the massively helpful section in the O'Reilly
>book but I cannot get the telnet version working. the script 'runs' with no
>errors, but it doesn't stay running and bind to port 23 giving me my telnet
>server. I enclose a zip with the ssh and the telnet versions, if anyone can
>give me any pointers it would be massively appreciated (I haven't even
>attempted to add in the 'login' which is in the SSH version... so any help
>on that would be great too :) )

Are you using twistd to run it?

    $ twistd -noy telnet_server.py
    Removing stale pidfile twistd.pid
    2007-08-08 08:31:05-0400 [-] Log opened.
    2007-08-08 08:31:05-0400 [-] twistd 2.5.0+r20987 (/usr/bin/python 2.4.3) starting up
    2007-08-08 08:31:05-0400 [-] reactor class: <class 'twisted.internet.selectreactor.SelectReactor'>
    2007-08-08 08:31:05-0400 [-] twisted.internet.protocol.ServerFactory starting on 23
    2007-08-08 08:31:05-0400 [-] Starting factory <twisted.internet.protocol.ServerFactory instance at 0xb77f5fac>
    ...

After I connect to the port, it reports several tracebacks and drops the
connection.

Jean-Paul





More information about the Twisted-Python mailing list