blob: c32344e6bbb84c564a4282c9e2c91dbd0d2a132e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.spread import pb
from twisted.internet import reactor
class Two(pb.Referenceable):
def remote_print(self, arg):
print "two.print was given", arg
class One(pb.Root):
def __init__(self, two):
#pb.Root.__init__(self) # pb.Root doesn't implement __init__
self.two = two
def remote_getTwo(self):
print "One.getTwo(), returning my two called", self.two
return self.two
def remote_checkTwo(self, newtwo):
print "One.checkTwo(): comparing my two", self.two
print "One.checkTwo(): against your two", newtwo
if self.two == newtwo:
print "One.checkTwo(): our twos are the same"
two = Two()
root_obj = One(two)
reactor.listenTCP(8800, pb.PBServerFactory(root_obj))
reactor.run()
|