durusmail: durus-users: Example: starting a Durus server in another thread
Example: starting a Durus server in another thread
2006-08-19
2006-08-31
2006-08-31
Example: starting a Durus server in another thread
Damjan
2006-08-19
It's very simple:

from threading import Thread
from durus.storage_server import StorageServer
class StorageServerThread(Thread):
    def __init__(self, *args, **kw):
        Thread.__init__(self)
        self.server = StorageServer(*args, **kw)
    def run(self):
        self.server.serve()

t = StorageServerThread(address='durus.sock',storage=FileStorage('storage-
file.db'))
t.start()

BTW
I've found a very helpfull function durus.storage_server.wait_for_server
wait_for_server(host='127.0.0.1', port=2972, maxtries=30, sleeptime=2,
address=None)

These things really need documentation...
And how to make wait_for_server to wait forever?
maxtries=0 kills my Python interpreter.


--
damjan | дамјан
This is my jabber ID -->         damjan@bagra.net.mk
 -- not my mail address, it's a Jabber ID --^ :)
reply