diff options
Diffstat (limited to 'doc/core/howto/listings/pb/pb5client.py')
-rwxr-xr-x | doc/core/howto/listings/pb/pb5client.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/core/howto/listings/pb/pb5client.py b/doc/core/howto/listings/pb/pb5client.py new file mode 100755 index 0000000..3026780 --- /dev/null +++ b/doc/core/howto/listings/pb/pb5client.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (c) Twisted Matrix Laboratories. +# See LICENSE for details. + +from twisted.spread import pb +from twisted.internet import reactor +from twisted.cred import credentials + +def main(): + factory = pb.PBClientFactory() + reactor.connectTCP("localhost", 8800, factory) + def1 = factory.login(credentials.UsernamePassword("user1", "pass1")) + def1.addCallback(connected) + reactor.run() + +def connected(perspective): + print "got perspective ref:", perspective + print "asking it to foo(12)" + perspective.callRemote("foo", 12) + +main() |