[Twisted-Python] Running a PBServerFactory TCP Server as a Win32 Service.

william.lewis at uk.bnpparibas.com william.lewis at uk.bnpparibas.com
Mon Jan 23 13:27:19 EST 2006


Hi

I am attempting to run a PBServer as a win32 service using the following 
code:

        import win32serviceutil
        import win32service
        import win32event
        from twisted.spread import pb
        from twisted.internet import reactor
        import node

        class NodeService(win32serviceutil.ServiceFramework):
                _svc_name_ = 'NodeService'
                _svc_display_name_ = 'Node Server'

                def __init__(self, args):
                        win32serviceutil.ServiceFramework.__init__(self, 
args)

                def SvcDoRun(self):
                        n = node.Node()
                        reactor.listenTCP(node.port, 
pb.PBServerFactory(n))
                        reactor.run()

                def SvcStop(self):
 self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
                        reactor.stop()

        if __name__ == '__main__':
                win32serviceutil.HandleCommandLine(NodeService)

where my class "node.Node" inherits from pb.Root

When I try to start the service it just exits quickly without actually 
starting, but without any error.
I have implemented other python TCP servers (e.g. a simple xml-rpc server 
using  xmlrpclib.py) as win32 services and so am
not sure why I am getting this behaviour. Any help would be appreciated.

Regards

William Lewis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20060123/01f64fbb/attachment.htm 


More information about the Twisted-Python mailing list