[Twisted-Python] help me on startService ( service.Service )

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Fri Feb 3 18:20:43 EST 2012


On 06:11 am, yueyoum at gmail.com wrote:
>Thanks for reply
>
>Yes, of course.
>
>I followed the turotial ,
>
>class FingerService(service.Service):
>    ...
>    def startService(self):
>        print 'start service'
>        ....
>
>application = service.Application('finger')
>f = FingerService()
>serviceCollection = service.IServiceCollection(application)
>internet.TCPServer(9000, f.get_FingerFactory()
>                            ).setServiceParent(serviceCollection)

Notice that nowhere here does `f` get attached to `application`.  You 
need this:

    f.setServiceParent(application)

Jean-Paul



More information about the Twisted-Python mailing list