def main(reactor, listen="tcp:4321", connect="tcp:localhost:6543"): clientEndpoint = clientFromString(reactor, connect) serverEndpoint = serverFromString(reactor, listen) def incoming(listening): def outgoing(connecting): listening.fount.flowTo(connecting.drain) connecting.fount.flowTo(listening.drain) flowFromEndpoint(clientEndpoint).addCallback(outgoing) flowFount = yield flowFountFromEndpoint(serverEndpoint) flowFount.flowTo(Listener(incoming)) yield Deferred()
def main(reactor, port="stdio:"): endpoint = serverFromString(reactor, port) flowFount = yield flowFountFromEndpoint(endpoint) flowFount.flowTo(Listener(mathFlow)) yield Deferred()
def main(reactor): endpoint = TCP4ServerEndpoint(reactor, 4321) flowFount = yield flowFountFromEndpoint(endpoint) flowFount.flowTo(Listener(echoTubeFactory)) yield Deferred()
def main(reactor, listenOn="stdio:"): endpoint = serverFromString(reactor, listenOn) flowFount = yield flowFountFromEndpoint(endpoint) flowFount.flowTo(Listener(echoFlow)) yield Deferred()
def main(): serverEndpoint = serverFromString(reactor, "tcp:1234") flowFount = yield flowFountFromEndpoint(serverEndpoint) flowFount.flowTo(Listener(mathFlow)) yield Deferred()