<s> from twisted . spread import pb , jelly <EOL> from twisted . python import log <EOL> from twisted . internet import reactor <EOL> from copy2_classes import SenderPond <EOL> class Sender : <EOL> def __init__ ( self , pond ) : <EOL> self . pond = pond <EOL> def got_obj ( self , obj ) : <EOL> d = obj . callRemote ( "<STR_LIT>" , self . pond ) <EOL> d . addCallback ( self . ok ) . addErrback ( self . notOk ) <EOL> def ok ( self , response ) : <EOL> print "<STR_LIT>" , response <EOL> reactor . stop ( ) <EOL> def notOk ( self , failure ) : <EOL> print "<STR_LIT>" <EOL> if failure . type == jelly . InsecureJelly : <EOL> print "<STR_LIT>" <EOL> else : <EOL> print failure <EOL> reactor . stop ( ) <EOL> return None <EOL> def main ( ) : <EOL> pond = SenderPond ( <NUM_LIT:3> , <NUM_LIT:4> ) <EOL> print "<STR_LIT>" % pond . count ( ) <EOL> sender = Sender ( pond ) <EOL> factory = pb . PBClientFactory ( ) <EOL> reactor . connectTCP ( "<STR_LIT:localhost>" , <NUM_LIT> , factory ) <EOL> deferred = factory . getRootObject ( ) <EOL> deferred . addCallback ( sender . got_obj ) <EOL> reactor . run ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
