3 # Copyright (c) Twisted Matrix Laboratories.
4 # See LICENSE for details.
6 from twisted.spread import pb, jelly
7 from twisted.python import log
8 from twisted.internet import reactor
11 def setStuff(self, color, numFrogs):
13 self.numFrogs = numFrogs
15 print "%d frogs" % self.numFrogs
17 class CopyPond(LilyPond, pb.Copyable):
21 def __init__(self, pond):
24 def got_obj(self, remote):
26 d = remote.callRemote("takePond", self.pond)
27 d.addCallback(self.ok).addErrback(self.notOk)
29 def ok(self, response):
30 print "pond arrived", response
32 def notOk(self, failure):
33 print "error during takePond:"
34 if failure.type == jelly.InsecureJelly:
35 print " InsecureJelly"
42 from copy_sender import CopyPond # so it's not __main__.CopyPond
44 pond.setStuff("green", 7)
47 print ".".join([pond.__class__.__module__, pond.__class__.__name__])
50 factory = pb.PBClientFactory()
51 reactor.connectTCP("localhost", 8800, factory)
52 deferred = factory.getRootObject()
53 deferred.addCallback(sender.got_obj)
56 if __name__ == '__main__':