Initial import to Tizen
[profile/ivi/python-twisted.git] / doc / core / howto / listings / pb / copy2_receiver.py
1 #!/usr/bin/env python
2
3 # Copyright (c) Twisted Matrix Laboratories.
4 # See LICENSE for details.
5
6 from twisted.application import service, internet
7 from twisted.internet import reactor
8 from twisted.spread import pb
9 import copy2_classes # needed to get ReceiverPond registered with Jelly
10
11 class Receiver(pb.Root):
12     def remote_takePond(self, pond):
13         print " got pond:", pond
14         print " count %d" % pond.count()
15         return "safe and sound" # positive acknowledgement
16     def remote_shutdown(self):
17         reactor.stop()
18
19 application = service.Application("copy_receiver")
20 internet.TCPServer(8800, pb.PBServerFactory(Receiver())).setServiceParent(
21     service.IServiceCollection(application))