~ntt-pf-lab/nova/monkey_patch_notification

« back to all changes in this revision

Viewing changes to vendor/Twisted-10.0.0/doc/core/examples/pbsimpleclient.py

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
 
3
# See LICENSE for details.
 
4
 
 
5
 
 
6
from twisted.spread import pb
 
7
from twisted.internet import reactor
 
8
from twisted.python import util
 
9
 
 
10
factory = pb.PBClientFactory()
 
11
reactor.connectTCP("localhost", 8789, factory)
 
12
d = factory.getRootObject()
 
13
d.addCallback(lambda object: object.callRemote("echo", "hello network"))
 
14
d.addCallback(lambda echo: 'server echoed: '+echo)
 
15
d.addErrback(lambda reason: 'error: '+str(reason.value))
 
16
d.addCallback(util.println)
 
17
d.addCallback(lambda _: reactor.stop())
 
18
reactor.run()