Example #1
0
def main(reactor, duration):
    concurrency = 50

    factory = ServerFactory()
    factory.protocol = CloseConnection

    interface = '127.0.0.%d' % (int(time()) % 254 + 1, )
    interface = '127.0.0.1'
    port = reactor.listenTCP(0, factory, interface=interface)

    client = Client(
        reactor,
        TCP4ClientEndpoint(reactor,
                           port.getHost().host,
                           port.getHost().port,
                           bindAddress=(interface, 0)))
    d = client.run(concurrency, duration)

    def cleanup(passthrough):
        d = port.stopListening()
        d.addCallback(lambda ignored: passthrough)
        return d

    d.addCallback(cleanup)
    return d
Example #2
0
def main(reactor, duration):
    server = BenchmarkSSHFactory()
    port = reactor.listenTCP(0, server)
    client = Client(
        reactor,
        TCP4ClientEndpoint(reactor, '127.0.0.1', port.getHost().port))
    d = client.run(1, duration)
    def cleanup(passthrough):
        d = port.stopListening()
        d.addCallback(lambda ignored: passthrough)
        return d
    d.addCallback(cleanup)
    return d
Example #3
0
def main(reactor, duration):
    concurrency = 15

    server = PBServerFactory(BenchRoot())
    port = reactor.listenTCP(0, server)
    client = Client(reactor, port.getHost().port)
    d = client.run(concurrency, duration)
    def cleanup(passthrough):
        d = port.stopListening()
        d.addCallback(lambda ignored: passthrough)
        return d
    d.addCallback(cleanup)
    return d
Example #4
0
def main(reactor, duration):
    concurrency = 15

    server = PBServerFactory(BenchRoot())
    port = reactor.listenTCP(0, server)
    client = Client(reactor, port.getHost().port)
    d = client.run(concurrency, duration)
    def cleanup(passthrough):
        d = port.stopListening()
        d.addCallback(lambda ignored: passthrough)
        return d
    d.addCallback(cleanup)
    return d
Example #5
0
def main(reactor, duration):
    concurrency = 15

    server = ServerFactory()
    server.protocol = lambda: AMP(locator=BenchmarkLocator())
    port = reactor.listenTCP(0, server)
    client = Client(reactor, port.getHost().port)
    d = client.run(concurrency, duration)
    def cleanup(passthrough):
        d = port.stopListening()
        d.addCallback(lambda ignored: passthrough)
        return d
    d.addCallback(cleanup)
    return d
Example #6
0
def main(reactor, duration):
    server = BenchmarkSSHFactory()
    port = reactor.listenTCP(0, server)
    client = Client(
        reactor, TCP4ClientEndpoint(reactor, '127.0.0.1',
                                    port.getHost().port))
    d = client.run(1, duration)

    def cleanup(passthrough):
        d = port.stopListening()
        d.addCallback(lambda ignored: passthrough)
        return d

    d.addCallback(cleanup)
    return d
Example #7
0
def main(reactor, duration):
    concurrency = 15

    server = ServerFactory()
    server.protocol = lambda: AMP(locator=BenchmarkLocator())
    port = reactor.listenTCP(0, server)
    client = Client(reactor, port.getHost().port)
    d = client.run(concurrency, duration)

    def cleanup(passthrough):
        d = port.stopListening()
        d.addCallback(lambda ignored: passthrough)
        return d

    d.addCallback(cleanup)
    return d
Example #8
0
def main(reactor, duration):
    global interface
    concurrency = 10

    root = Resource()
    root.putChild('', Data("Hello, world", "text/plain"))

    interface += 1
    interface %= 255
    port = reactor.listenTCP(
        0, Site(root), backlog=128, interface='127.0.0.%d' % (interface,))
    agent = Agent(reactor)
    client = Client(reactor, port.getHost().host, port.getHost().port, agent)
    d = client.run(concurrency, duration)
    def cleanup(passthrough):
        d = port.stopListening()
        d.addCallback(lambda ignored: passthrough)
        return d
    d.addBoth(cleanup)
    return d
Example #9
0
def main(reactor, duration):
    concurrency = 50

    factory = ServerFactory()
    factory.protocol = CloseConnection

    interface = '127.0.0.%d' % (int(time()) % 254 + 1,)
    port = reactor.listenTCP(0, factory, interface=interface)

    client = Client(
        reactor, TCP4ClientEndpoint(
            reactor, port.getHost().host, port.getHost().port,
            bindAddress=(interface, 0)))
    d = client.run(concurrency, duration)
    def cleanup(passthrough):
        d = port.stopListening()
        d.addCallback(lambda ignored: passthrough)
        return d
    d.addCallback(cleanup)
    return d
Example #10
0
def main(reactor, duration):
    global interface
    concurrency = 10

    root = Resource()
    root.putChild(b'', Data(b"Hello, world", "text/plain"))

    interface += 1
    interface %= 255
    port = reactor.listenTCP(
        0, Site(root), backlog=128, interface='127.0.0.%d' % (interface,))
    agent = Agent(reactor)
    client = Client(reactor, port.getHost().host, port.getHost().port, agent)
    d = client.run(concurrency, duration)
    def cleanup(passthrough):
        d = port.stopListening()
        d.addCallback(lambda ignored: passthrough)
        return d
    d.addBoth(cleanup)
    return d
Example #11
0
def main(reactor, duration):
    concurrency = 10

    client = Client(reactor)
    d = client.run(concurrency, duration)
    return d
def main(reactor, duration):
    concurrency = 10

    client = Client(reactor)
    d = client.run(concurrency, duration)
    return d