fork vs threading.Thread
Jordan Apgar
twistedphrame at gmail.com
Fri Feb 12 22:57:08 EST 2010
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.
More information about the Python-list
mailing list