use jegarn\manager\GroupManager; use jegarn\manager\UserManager; use jegarn\packet\Packet; use jegarn\packet\AuthPacket; use jegarn\packet\TextChatPacket; use jegarn\packet\TextChatroomPacket; use jegarn\packet\TextGroupChatPacket; use jegarn\util\ConvertUtil; require __DIR__ . '/bootstrap.php'; ini_set('default_socket_timeout', -1); if ($argc < 3) { echo "php benchmark.php host port [startUserId] [userCount] [executeTime]\n"; exit(0); } Gbl::$host = $argv[1]; Gbl::$port = intval($argv[2]); Gbl::$uidIndex = isset($argv[3]) ? intval($argv[3]) : 30000; Gbl::$userCount = isset($argv[4]) ? intval($argv[4]) : 10; Gbl::$executeTime = isset($argv[5]) ? intval($argv[5]) : 60; Gbl::init(); // real do for ($i = 0; $i < Gbl::$userCount; ++$i) { $user = Gbl::getUser(); $socket = new Socket(Gbl::$host, Gbl::$port, $user['uid'], $user['account'], $user['password'], $user['groupId'], $user['chatroomId']); if ($socket->connect()) { Gbl::$fpList[] = $socket->fp; Gbl::$socketList[(int) $socket->fp] = $socket; $socket->sendAuthPacket(); } else { echo "[ERROR] connect error user id {$user['uid']}\n"; }