/** * The entry method. * * @return void */ public function main() { $run = 'hoa://Data/Variable/Run'; while (false !== ($c = $this->getOption($v))) { switch ($c) { case 'r': $run = $v; break; case 'h': case '?': return $this->usage(); case '__ambiguous': $this->resolveOptionAmbiguity($v); break; } } $this->parser->listInputs($workerId); if (null === $workerId) { return $this->usage(); } $run = resolve($run); Core::getInstance()->initialize(['protocol.Data/Variable/Run' => "\r" . $run . DS]); $password = $this->readPassword('Password: '); $sw = new Worker\Backend\Shared($workerId, $password); $sw->stop(); return; }
/** * The entry method. * * @return void */ public function main() { $fastcgi = '127.0.0.1:9000'; while (false !== ($c = $this->getOption($v))) { switch ($c) { case 'f': $fastcgi = $v; break; case 'h': case '?': return $this->usage(); case '__ambiguous': $this->resolveOptionAmbiguity($v); break; } } $this->parser->listInputs($workerPath); if (null === $workerPath) { return $this->usage(); } $output = Worker\Backend\Shared::start('tcp://' . $fastcgi, $workerPath); echo $output, "\n"; return; }
/** * Get informations about the shared worker. * * @return array */ public function getInformations() { $this->_client->connect(); $this->_client->writeAll(Backend\Shared::pack(Backend\Shared::TYPE_INFORMATIONS, "")); $this->_client->read(2); // skip type. $length = unpack('Nl', $this->_client->read(4)); $message = $this->_client->read($length['l']); $this->_client->read(1); // skip eom. $this->_client->disconnect(); return unserialize($message); }