Ticket #5562: pb_bugs_server.py

File pb_bugs_server.py, 480 bytes (added by dynamicgl, 3 years ago)
Line 
1#coding=utf-8
2from twisted.internet import iocpreactor
3iocpreactor.install()
4from twisted.internet import reactor,defer,task
5from twisted.spread import pb,jelly
6
7class MathRpc(pb.Root):
8    def remote_ok(self,a):
9        return a
10       
11    def remote_bad(self, a):
12        d = defer.Deferred()
13        reactor.callLater(0,d.callback,a)
14        return d
15
16if __name__ == "__main__":
17    reactor.listenTCP(12345, pb.PBServerFactory(MathRpc()))
18    reactor.run()