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"; } } $second = 15; echo "wait {$second} second\n"; sleep($second); $start = time(); echo "go!!!\n"; while (true) { $readList = $writeList = $errorList = Gbl::$fpList; if (socket_select($readList, $writeList, $errorList, null) > 0) { if ($readList) { foreach ($readList as $fp) { Gbl::$socketList[(int) $fp]->receive();