Initial import to Tizen
[profile/ivi/python-twisted.git] / doc / core / howto / listings / pb / pb5client.py
1 #!/usr/bin/env python
2
3 # Copyright (c) Twisted Matrix Laboratories.
4 # See LICENSE for details.
5
6 from twisted.spread import pb
7 from twisted.internet import reactor
8 from twisted.cred import credentials
9
10 def main():
11     factory = pb.PBClientFactory()
12     reactor.connectTCP("localhost", 8800, factory)
13     def1 = factory.login(credentials.UsernamePassword("user1", "pass1"))
14     def1.addCallback(connected)
15     reactor.run()
16
17 def connected(perspective):
18     print "got perspective ref:", perspective
19     print "asking it to foo(12)"
20     perspective.callRemote("foo", 12)
21
22 main()