3 # Copyright (c) Twisted Matrix Laboratories.
4 # See LICENSE for details.
6 from twisted.application import service, internet
7 from twisted.internet import reactor
8 from twisted.spread import pb
11 class Receiver(pb.Root):
12 def remote_takePond(self, pond):
14 print "got pond:", pond # a DuckPondCache
15 self.remote_checkDucks()
16 def remote_checkDucks(self):
17 print "[%d] ducks: " % self.pond.count(), self.pond.getDucks()
18 def remote_ignorePond(self):
19 # stop watching the pond
21 # gc causes __del__ causes 'decache' msg causes stoppedObserving
23 def remote_shutdown(self):
26 application = service.Application("copy_receiver")
27 internet.TCPServer(8800, pb.PBServerFactory(Receiver())).setServiceParent(
28 service.IServiceCollection(application))