1 # Copyright (c) Twisted Matrix Laboratories.
2 # See LICENSE for details.
5 PB copy receiver example.
7 This is a Twisted Application Configuration (tac) file. Run with e.g.
8 twistd -ny copy_receiver.tac
10 See the twistd(1) man page or
11 http://twistedmatrix.com/documents/current/howto/application for details.
15 if __name__ == '__main__':
19 from twisted.application import service, internet
20 from twisted.internet import reactor
21 from twisted.spread import pb
22 from copy_sender import LilyPond, CopyPond
24 from twisted.python import log
25 #log.startLogging(sys.stdout)
27 class ReceiverPond(pb.RemoteCopy, LilyPond):
29 pb.setUnjellyableForClass(CopyPond, ReceiverPond)
31 class Receiver(pb.Root):
32 def remote_takePond(self, pond):
33 print " got pond:", pond
35 return "safe and sound" # positive acknowledgement
36 def remote_shutdown(self):
39 application = service.Application("copy_receiver")
40 internet.TCPServer(8800, pb.PBServerFactory(Receiver())).setServiceParent(
41 service.IServiceCollection(application))