예제 #1
0
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()
예제 #2
0
def main(reactor, port="stdio:"):
    endpoint = serverFromString(reactor, port)
    flowFount = yield flowFountFromEndpoint(endpoint)
    flowFount.flowTo(Listener(mathFlow))
    yield Deferred()
예제 #3
0
def main(reactor):
    endpoint = TCP4ServerEndpoint(reactor, 4321)
    flowFount = yield flowFountFromEndpoint(endpoint)
    flowFount.flowTo(Listener(echoTubeFactory))
    yield Deferred()
예제 #4
0
파일: echoflow.py 프로젝트: tehasdf/tubes
def main(reactor, listenOn="stdio:"):
    endpoint = serverFromString(reactor, listenOn)
    flowFount = yield flowFountFromEndpoint(endpoint)
    flowFount.flowTo(Listener(echoFlow))
    yield Deferred()
예제 #5
0
def main():
    serverEndpoint = serverFromString(reactor, "tcp:1234")
    flowFount = yield flowFountFromEndpoint(serverEndpoint)
    flowFount.flowTo(Listener(mathFlow))
    yield Deferred()