Created
April 22, 2013 13:16
-
-
Save therve/5434807 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from twisted.python import log | |
from twisted.internet import reactor | |
from twotp import Process, readCookie, buildNodeName | |
def receive(process): | |
def cb(resp): | |
print "Got response", resp | |
def eb(error): | |
print "Got error", error | |
return process.receive( | |
).addCallback(cb | |
).addErrback(eb | |
).addBoth(lambda x: receive(process)) | |
cookie = readCookie() | |
nodeName = 'node@host' | |
log.startLogging(sys.stdout) | |
process = Process(nodeName, cookie) | |
process.register("main") | |
process.listen().addCallback(lambda x: receive(process)) | |
reactor.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment