def start_all_dummy_clients(nclients):
 global NCLIENTS
 NCLIENTS = int(nclients)
 actions = DUMMYRUNNER_SETTINGS.ACTIONS
 if (len(actions) < 2):
  print(ERROR_FEW_ACTIONS)
  return
 pratio = (1.0 / sum((tup[0] for tup in actions[2:])))
 (flogin, flogout, probs, cfuncs) = (actions[0], actions[1], [(tup[0] * pratio) for tup in actions[2:]], [tup[1] for tup in actions[2:]])
 cprobs = [sum((v for (i, v) in enumerate(probs) if (i <= k))) for k in range(len(probs))]
 actions = ((flogin, flogout) + tuple(zip(cprobs, cfuncs)))
 factory = DummyFactory(actions)
 for i in range(NCLIENTS):
  reactor.connectTCP('localhost', TELNET_PORT, factory)
 reactor.run()

def start_all_dummy_clients ( nclients ) : global NCLIENTS NCLIENTS = int ( nclients ) actions = DUMMYRUNNER_SETTINGS . ACTIONS if ( len ( actions ) < 2 ) : print ( ERROR_FEW_ACTIONS ) return pratio = ( 1.0 / sum ( ( tup [ 0 ] for tup in actions [ 2 : ] ) ) ) ( flogin , flogout , probs , cfuncs ) = ( actions [ 0 ] , actions [ 1 ] , [ ( tup [ 0 ] * pratio ) for tup in actions [ 2 : ] ] , [ tup [ 1 ] for tup in actions [ 2 : ] ] ) cprobs = [ sum ( ( v for ( i , v ) in enumerate ( probs ) if ( i <= k ) ) ) for k in range ( len ( probs ) ) ] actions = ( ( flogin , flogout ) + tuple ( zip ( cprobs , cfuncs ) ) ) factory = DummyFactory ( actions ) for i in range ( NCLIENTS ) : reactor . connectTCP ( 'localhost' , TELNET_PORT , factory ) reactor . run ( )
initialize all clients .