asyncore loop and cmdloop problem

kaklis at gmail.com kaklis at gmail.com
Tue May 25 04:42:06 EDT 2010


Hi to all,
i'm creating a command line application using asyncore and cmd. At

if __name__ == '__main__':
    import socket

    args = sys.argv[1:]
    if not args:
        print "Usage: %s querystring" % sys.argv[0]
        sys.exit(0)


    address = ('localhost', 0) # let the kernel give us a port
    server = EchoServer(address)
    ip, port = server.address # find out what port we were given

    asyncore.loop()
    CmdClass().cmdloop()

what i want is that the above commands asyncore.loop() and
CmdClass().cmdloop()
running at the same time. Meaning that while the application is in cmd
mode
with the cmdloop(), it is still able to listen for incoming messages?
What should i do?

thanks in advance
A.K.



More information about the Python-list mailing list