Re: 回覆: Re: 回覆: Re: [Twisted-web] How to wait for a deferred object?

Christopher Armstrong radeex at
Mon Dec 5 13:48:02 MST 2005

]On 12/5/05, Suet Lung Cheung <suetlung2003 at> wrote:
> Hi Paul,
>      Thanks for your reply again. Your example works for me. I found the
> difference. I use a serviceCollection to include my service. Does it mean
> anything? my code is in this way...
>  application = service.Application('chatroom')
>  f = ChatService()
>  serviceCollection = service.IServiceCollection(application)
>  internet.TCPServer (1234,
> ChatFactoryFromService(f)).setServiceParent(serviceCollection)
> and I have implemented stopService() in ChatService. Is it different if I
> use serviceCollection? Thanks again.

It looks like the problem here is that you're not setting your
ChatService's service parent to the application (by the way, you don't
need to adapt to IServiceCollection - setServiceParent tries to adapt
to IServiceCollection itself).

application = service.Application('chatroom')
f = ChatService()

should sort you out.

  Twisted   |  Christopher Armstrong: International Man of Twistery
   Radix    |    --
            |  Release Manager, Twisted Project
  \\\V///   |    --
   |o O|    |

More information about the Twisted-web mailing list