Skip to content

Instantly share code, notes, and snippets.

@therve
Created April 22, 2013 13:16
Show Gist options
  • Save therve/5434807 to your computer and use it in GitHub Desktop.
Save therve/5434807 to your computer and use it in GitHub Desktop.
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