docs/core/examples/pbsimple.py
raw| 1 | # Copyright (c) Twisted Matrix Laboratories. |
| 2 | # See LICENSE for details. |
| 3 | |
| 4 | |
| 5 | from twisted.internet import reactor |
| 6 | from twisted.spread import pb |
| 7 | |
| 8 | |
| 9 | class Echoer(pb.Root): |
| 10 | def remote_echo(self, st): |
| 11 | print("echoing:", st) |
| 12 | return st |
| 13 | |
| 14 | |
| 15 | if __name__ == "__main__": |
| 16 | reactor.listenTCP(8789, pb.PBServerFactory(Echoer())) |
| 17 | reactor.run() |