Threads with Cmd and socket server combination

K

kaklis

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top