dont call the .run() method, call the .start() method which is defined the
Thread class (and should NOT be overridden).

tftpserv.start()

xmlserv.start()



On Fri, Feb 12, 2010 at 10:57 PM, Jordan Apgar <twistedphr...@gmail.com>wrote:

> I'm trying to run two servers in the same program at once.  Here are
> the two:
> class TftpServJ(Thread):
>    def __init__(self, ip, root, port=69, debug = False ):
>        Thread.__init__(self)
>        setup stuff here
>
>    def run(self):
>        try:
>            self.server.listen(self.ip, self.port)
>        except KeyboardInterrupt:
>            pass
>
> and
> class XMLServer(Thread):
>    def __init__(self, host, port, hostid, rsa_key):
>        Thread.__init__(self)
>         setup stuff
>
>    def run(self):
>        self.server.serve_forever()
>
>
> I call them as:
> tftpserv = TftpServJ(host, "/home/twistedphrame/Desktop/xmlrpc_server/
> server")
> tftpserv.run()
> xmlserv = XMLServer(host, port, HostID, key)
> xmlserv.run()
>
>
> it seems that tftpserv runs but wont go on to spawn xmlserv as well.
> do I need to fork if I want both these to run at the same time?  It
> was my impression that by using Thread execution in the main program
> would continue.
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to