Sets the timeout in MS.

@param int $timeout

@return Client
@throws \RuntimeException
496070
public function setTimeout($timeout)
    {
        if (is_string($timeout) && ctype_digit($timeout)) {
            $timeout = (int) $timeout;
        } elseif (!is_int($timeout)) {
            throw new \RuntimeException('Unable to set timeout.');
        }
        $this->timeout = $timeout;

        return $this;
    }
983506
public function timeout($ms)
    {
        $this->timeout = (integer) $ms;
        $this->riakCursor->timeout($ms);
        return $this;
    }
1131493
public function wait($timeout = 30)
    {
        $lastException = null;
        for ($i = 0; $i < $timeout; $i++) {
            try {
                $this->text();
                return $this;
            } catch (WebDriver_Exception $e) {
                $lastException = $e;
                sleep(1);
            }
        }

        if (null !== $lastException) {
            throw $lastException;
        }

        return $this;
    }
582822
public function timeout($ms)
    {
        if ( ! method_exists('MongoCommandCursor', 'timeout')) {
            throw new BadMethodCallException('MongoCommandCursor::timeout() is not available');
        }

        $this->timeout = (integer) $ms;
        $this->mongoCommandCursor->timeout($ms);

        return $this;
    }
71048
public function send($timeout=null) 
	{
		$format = $this->params->getString("format",null);

		if (!strrpos($this->method, ".")) {
			$this->host = "socialize.".$this->apiDomain;
			$this->path = "/socialize.".$this->method;
		} else {
			$tokens = explode( ".", $this->method );
			$this->host = $tokens[0].".".$this->apiDomain;
			$this->path = "/".$this->method;
		}
		
		//set json as default format.
		if (empty($format))
		{
			$format =  "json";
			$this->setParam("format", $format);
		}
		if(!empty($timeout))
		{
			$this->traceField("timeout",$timeout);
		}
		
		if (empty($this->method) || (empty($this->apiKey) and empty($this->userKey)) )
		{
			return new GSResponse($this->method,null,$this->params,400002,null,$this->traceLog);
		}
		
		if ($this->useHTTPS && empty(GSRequest::$cafile)) 
		{
			return new GSResponse($this->method,null,$this->params,400003,null,$this->traceLog);
		}

		try 
		{
			$this->setParam("httpStatusCodes", "false");
			
			$this->traceField("userKey", $this->userKey);
			$this->traceField("apiKey", $this->apiKey);
			$this->traceField("apiMethod", $this->method);
			$this->traceField("params",$this->params);
			$this->traceField("useHTTPS", $this->useHTTPS);

			$responseStr = $this->sendRequest("POST", $this->host, $this->path, $this->params, $this->apiKey, $this->secretKey, $this->useHTTPS,$timeout, $this->userKey);
			
			return new GSResponse($this->method,$responseStr,null,0,null,$this->traceLog);
		}
		catch (Exception $ex) {
			$errcode = 500000;
			$errMsg = $ex->getMessage();
		    $length = strlen("Operation timed out");
		    if((substr($ex->getMessage(), 0, $length) === "Operation timed out"))
			{
				 $errcode = 504002;
				 $errMsg = "Request Timeout";
			}
	
			return new GSResponse($this->method,null,$this->params,$errcode,$errMsg, $this->traceLog);
		}
	}
1356259
public function timeout($timeout = null)
    {
        if ($timeout !== null) {
            $this->lastTimeout = $timeout;
        }
        $this->ev->add($this->lastTimeout / 1e6);
    }
1180824
public function setTimeout($timeout)
    {
        $timeout = intval($timeout);
        if (!empty($timeout)) {
            $this->timeout = $timeout;
        }
    }
843668
public function timeout($timeout = null)
    {
        $this->timeout = (null === $timeout) ? $this->defaultTimeout : $timeout;
        return $this;
    }
860946
protected function childSetTimeout($timeout)
    {
        $start_time = time();
        $self = $this;
        $this->on('tick', function () use ($timeout, $start_time, $self) {
            if ($start_time + $timeout < time()) $self->shutdown(1);
        });
    }
212500
public function setSendTimeout($timeout)
    {
        $this->sendTimeoutSec_ = floor($timeout / 1000);
        $this->sendTimeoutUsec_ =
            ($timeout - ($this->sendTimeoutSec_ * 1000)) * 1000;
    }
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);
    }
987426
public function setCurlTimeout($seconds)
    {
        if (!is_numeric($seconds) || $seconds < 0) {
            throw new \InvalidArgumentException('Timeout value must be numeric and a non-negative number.');
        }

        $this->curlTimeout = $seconds;
        return $this;
    }
1093100
public function processTime($timeout=NULL) {
		if (is_null($timeout)) {
			return $this->__process(NULL);
		} else {
			return $this->__process($timeout * 1000000);
		}
	}
594408
public function sendAndWait($command, $timeout = 300)
    {
        $commandMessage = $this->wrapCommandWithMessageEnvelope($command);

        // Todo: return future callback and pass it along for dispatching.
        return $this->commandBus->dispatch($commandMessage);
    }
694498
public function connect($timeout = 0.5)
    {
        if (!extension_loaded('swoole'))
        {
            throw new \Exception('swoole extension is required for WebSocketAsync');
        }

        //没有onMessage
        if (!$this->_callback('message'))
        {
            throw new \Exception('no message event callback.');
        }

        $type = SWOOLE_TCP;
        if ($this->ssl)
        {
            $type |= SWOOLE_SSL;
        }

        $this->socket = new \swoole_client($type, SWOOLE_SOCK_ASYNC);
        if ($this->ssl_key_file)
        {
            $this->socket->set(array(
                'ssl_key_file' => $this->ssl_key_file,
                'ssl_cert_file' => $this->ssl_cert_file
            ));
        }

        $this->socket->on("connect", array($this, 'onConnect'));
        $this->socket->on("receive", array($this, 'onReceive'));
        $this->socket->on("error", array($this, 'onError'));
        $this->socket->on("close", array($this, 'onClose'));

        $this->socket->connect($this->host, $this->port, $timeout);
    }
163392
protected function armTimeoutMonitor($timeout, callable $callback)
    {
        $timer = $this->loop->addTimer($timeout, function ($timer) use ($callback) {
            $this->disconnect();
            \call_user_func($callback, $this, new ConnectionException($this, 'Connection timed out'));
        });

        return $timer;
    }
188223
public function setTimeout($timeout)
    {
        $timeout = is_scalar($timeout) ? (int) $timeout : 0;

        return $timeout < 1
            ? $this->timeout
            : $this->timeout = $timeout;
    }