Threads with Cmd and socket server combination
kaklis at gmail.com
kaklis at gmail.com
Sun May 30 15:07:04 EDT 2010
hi,
I have implement a command line app using Python's cmd library module
and it works fine.
I 've also create a simple threaded socket server. How can i merge the
two ones, so that the
console app, is also a listening server? How can i achieve that with
threads?
I'm trying for days and i can't make it work! I know it can be done
with Twisted but i want
to understand how thread works.
The console:
class BM(CmdBase):
"""Simple custom command processor"""
def do_acmd(self):
pass
if __name__ == '__main__':
BM().cmdloop()
and the Server:
class MyClientHandler(SocketServer.BaseRequestHandler):
def handle(self):
pass
server = SocketServer.ThreadingTCPServer(myaddr, MyClientHandler)
server.serve_forever( )
Thanks in advance
Threads can be so difficult
A.K.
More information about the Python-list
mailing list