Set the (network) timeout.

@param int $timeout

@return self
552406
public function setTimeout($timeout)
    {
        $this->timeout = $timeout;

        if($this->hasValidResource() && $this->timeout !== -1) {
            stream_set_timeout($this->resource, $timeout);
        }

        return $this;
    }
625093
public CliCommandBuilder setTimeout(final int timeout) {
        if (timeout > 0) {
            addCliArgument(CliArgument.TIMEOUT, Integer.toString(timeout));
        } else {
            addCliArgument(CliArgument.TIMEOUT, null);
        }
        return this;
    }
832420
public void setConnectTimeout(int timeout) {
		Assert.isTrue(timeout >= 0, "Timeout must be a non-negative value");
		this.connectTimeout = timeout;
		setLegacyConnectionTimeout(getHttpClient(), timeout);
	}
1010804
public function setTimeout($timeout) {
        if (!is_int($timeout)) throw new IllegalTypeException('Illegal type of parameter $timeout: '.gettype($timeout));
        if ($timeout < 1)      throw new InvalidArgumentException('Invalid argument $timeout: '.$timeout);

        $this->timeout = $timeout;
        return $this;
    }
1313125
public function setTimeout($time=null)
    {
        if (!is_null($time)) {
           set_time_limit($time)||ini_set("max_execution_time", $time);
        }
        return $this;
    }
1314120
public function connect($timeout = self::TIMEOUT, $test = false)
    {
        Argument::i()
            ->test(1, 'int')
            ->test(2, 'bool');

        $host = $this->host;

        if ($this->ssl) {
            $host = 'ssl://' . $host;
        } else {
            $host = 'tcp://' . $host;
        }

        $errno  =  0;
        $errstr = '';
        $this->socket = @stream_socket_client($host.':'.$this->port, $errno, $errstr, $timeout);

        if (!$this->socket || strlen($errstr) > 0 || $errno > 0) {
            //throw exception
            Exception::i()
                ->setMessage(Exception::SERVER_ERROR)
                ->addVariable($host.':'.$this->port)
                ->trigger();
        }

        $this->receive();

        if (!$this->call('EHLO '.$_SERVER['HTTP_HOST'], 250)
        && !$this->call('HELO '.$_SERVER['HTTP_HOST'], 250)) {
            $this->disconnect();
            //throw exception
            Exception::i()
                ->setMessage(Exception::SERVER_ERROR)
                ->addVariable($host.':'.$this->port)
                ->trigger();
        }

        if ($this->tls && !$this->call('STARTTLS', 220, 250)) {
            if (!stream_socket_enable_crypto($this->socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
                $this->disconnect();
                //throw exception
                Exception::i()
                    ->setMessage(Exception::TLS_ERROR)
                    ->addVariable($host.':'.$this->port)
                    ->trigger();
            }

            if (!$this->call('EHLO '.$_SERVER['HTTP_HOST'], 250)
            && !$this->call('HELO '.$_SERVER['HTTP_HOST'], 250)) {
                $this->disconnect();
                //throw exception
                Exception::i()
                    ->setMessage(Exception::SERVER_ERROR)
                    ->addVariable($host.':'.$this->port)
                    ->trigger();
            }
        }

        if ($test) {
            $this->disconnect();
            return $this;
        }

        //login
        if (!$this->call('AUTH LOGIN', 250, 334)) {
            $this->disconnect();
            //throw exception
            Exception::i(Exception::LOGIN_ERROR)->trigger();
        }

        if (!$this->call(base64_encode($this->username), 334)) {
            $this->disconnect();
            //throw exception
            Exception::i()->setMessage(Exception::LOGIN_ERROR);
        }

        if (!$this->call(base64_encode($this->password), 235, 334)) {
            $this->disconnect();
            //throw exception
            Exception::i()->setMessage(Exception::LOGIN_ERROR);
        }

        return $this;
    }
193988
public function retry($timeout, $callback)
    {
        $start = time();

        beginning:

        if ($output = $callback()) {
            return $output;
        }

        if (time() - $start < $timeout) {
            sleep(5);

            goto beginning;
        }

        throw new TimeoutException($output);
    }
827146
public function iterate($timeout)
    {

        // call parent method and sleep for the default timeout
        parent::iterate($timeout);

        // iterate over the timer tasks that has to be executed
        foreach ($this->tasksToExecute as $taskId => $timerTaskWrapper) {
            // this should never happen
            if (!$timerTaskWrapper instanceof \stdClass) {
                // log an error message because we task wrapper has wrong type
                \error(sprintf('Timer-Task-Wrapper %s has wrong type %s', $taskId, get_class($timerTaskWrapper)));
                // we didn't foud a timer task ignore this
                continue;
            }

            // query if the task has to be executed now
            if ($timerTaskWrapper->executeAt < microtime(true)) {
                // load the timer task wrapper we want to execute
                if ($pk = $this->scheduledTimers[$timerId = $timerTaskWrapper->timerId]) {
                    // load the timer service registry
                    $timerServiceRegistry = $this->getApplication()->search(TimerServiceContextInterface::IDENTIFIER);

                    // lookup the timer from the timer service
                    $timer = $timerServiceRegistry->lookup($pk)->getTimers()->get($timerId);

                    // create and execute the timer task
                    $this->timerTasks[$taskId] = $timer->getTimerTask($this->getApplication());

                    // remove the key from the list of tasks to be executed
                    unset($this->tasksToExecute[$taskId]);

                } else {
                    // log an error message because we can't find the timer instance
                    \error(sprintf('Can\'t find timer %s to create timer task %s', $timerTaskWrapper->timerId, $taskId));
                }
            }
        }

        // collect the garbage (finished timer task jobs)
        $this->collectGarbage();

        // profile the size of the timer tasks to be executed
        if ($this->profileLogger) {
            $this->profileLogger->debug(
                sprintf('Processed timer service executor, executing %d timer tasks', sizeof($this->tasksToExecute))
            );
        }
    }
983506
public function timeout($ms)
    {
        $this->timeout = (integer) $ms;
        $this->riakCursor->timeout($ms);
        return $this;
    }
592637
public void setResponseTimeout(int timeout) {
        try {
            getConnection().setReadTimeout(timeout);
        } catch (Exception e) {
            Modbus.log().warning(e.getLocalizedMessage());
        }
    }
1356259
public function timeout($timeout = null)
    {
        if ($timeout !== null) {
            $this->lastTimeout = $timeout;
        }
        $this->ev->add($this->lastTimeout / 1e6);
    }
486225
public function setTimeout ($ms) {
    if (defined('CURLOPT_TIMEOUT_MS')) {
      $this->addCurlOption(CURLOPT_TIMEOUT_MS, $ms);

    } else {
      // older versions of php/libcurl don't have the sub-second timeout
      // functionality. Convert to nearest whole seconds not less than 1.
      $this->addCurlOption(CURLOPT_TIMEOUT, max(1, round($ms / 1000)));
    }
    return $this;
  }
691336
public function wait($timeout = -1)
    {
        $forever = ($timeout < 0);

        while ($this->isAlive()) {
            $this->read();

            if (!$forever && (microtime(true) - $this->start > $timeout)) {
                $this->kill(SIGKILL);
                break;
            }

            usleep(5000);
        }

        $this->cleanup();
    }
388347
protected function armTimeoutMonitor($timeout, callable $callback)
    {
        $timer = $this->loop->addTimer($timeout, function ($timer) {
            list($connection, $callback) = $timer->getData();

            $connection->disconnect();
            call_user_func($callback, $connection, new ConnectionException($connection, 'Connection timed out'));
        });

        $timer->setData([$this, $callback]);

        return $timer;
    }
1007665
public function setTimeout($timeout) {
        $this->_timeout = (int) $timeout;
        if ( ! is_null($this->_varnishConn)) {
            stream_set_timeout($this->_varnishConn, $this->_timeout);
        }
        return $this;
    }
1282043
public function setConnectTimeout($connectTimeout) {
        $this->connectTimeout = (float) $connectTimeout;
        if ($this->connectTimeout < 0) {
            throw new InvalidArgumentException('connect timeout < 0');
        }
        return $this;
    }
208499
public function iterate($timeout)
    {

        // call parent method and sleep for the default timeout
        parent::iterate($timeout);

        // create the instance and stack it
        $this->synchronized(function ($self) {

            // create the instance only if we're NOT dispatched and a class name is available
            if ($self->dispatched === false && $self->className) {
                // create the instance
                $instance = $self->getApplication()->search(ProviderInterface::IDENTIFIER)->get($self->className);

                // stack the instance
                $self->instances[] = $instance;

                // we're dispatched now
                $self->dispatched = true;
            }

        }, $this);
    }