Пример #1
0
def main():
    parser = standard_parser()
    options, args = parser.parse_args()
    factory = BenchmarkServer(options.port, '')
    print factory.start().getHost()
    sys.stdout.flush()
    reactor.run()  # run the main twisted reactor
Пример #2
0
def main():
    parser = standard_parser()
    options, args = parser.parse_args()
    factory = BenchmarkServer(options.port, '')
    print factory.start().getHost()
    sys.stdout.flush()
    reactor.run() # run the main twisted reactor
Пример #3
0
        if (not self.options.allow_sensor_creation or
            (abs(self.counter - self.no_of_sensors * 200) <=
            (self.no_of_sensors * 100))):
            self.sample_next_sensor()
        self.counter = 0
        reactor.callLater(TIMEOUT, self.periodic_check)

    def connectionLost(self, failure):
        print >>sys.stderr, "Connection lost, exiting"
        if reactor.running:
            reactor.stop()

def connected(protocol, options):
    protocol.options = options
    reactor.callLater(TIMEOUT, protocol.periodic_check)
    protocol.sample_next_sensor()

def not_connected(failure):
    print >>sys.stderr, failure
    print >>sys.stderr, "Exiting"
    reactor.stop()

if __name__ == '__main__':
    parser = standard_parser()
    parser.add_option('--allow-sensor-creation', dest='allow_sensor_creation',
                      default=False, action='store_true')
    options, args = parser.parse_args()
    run_client(('localhost', options.port), DemoClient, connected,
               (options,), not_connected)
    reactor.run()
Пример #4
0
def main():
    parser = standard_parser(1236)
    options, args = parser.parse_args()
    server = BenchmarkServer('localhost', options.port)
    server.run()
Пример #5
0
def main():
    parser = standard_parser(1236)
    options, args = parser.parse_args()
    server = BenchmarkServer('localhost', options.port)
    server.run()