Resque\Commands\Socket\Send::execute PHP Метод

execute() защищенный Метод

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $cmd = $input->getArgument('cmd');
        $host = $this->getConfig('connecthost');
        $port = $this->getConfig('connectport');
        $timeout = $this->getConfig('connecttimeout');
        if (!($fh = @fsockopen('tcp://' . $host, $port, $errno, $errstr, $timeout))) {
            $this->log('[' . $errno . '] ' . $errstr . ' host ' . $host . ':' . $port, Resque\Logger::ERROR);
            return;
        }
        stream_set_timeout($fh, 0, 500 * 1000);
        $payload = array('cmd' => $cmd, 'id' => $input->getArgument('id'), 'force' => $input->getOption('force'), 'json' => $this->getConfig('json'));
        Resque\Socket\Server::fwrite($fh, json_encode($payload));
        $response = '';
        while (($buffer = fgets($fh, 1024)) !== false) {
            $response .= $buffer;
        }
        $this->log('<pop>' . trim($response) . '</pop>');
        fclose($fh);
    }