Set write timeout. Only has effect before we connect.

@see http://php.net/manual/en/function.stream-set-timeout.php
346600
public function setTimeout(float $seconds): self
    {
        $this->validateTimeout($seconds);
        $this->timeout = $seconds;

        return $this;
    }
1253904
public function setWriteConcern($w, $timeout = 10000)
    {
        if (!$this->getMongoCollection()->setWriteConcern($w, (int) $timeout)) {
            throw new Exception('Error setting write concern');
        }

        return $this;
    }
927368
public void setConnectTimeout(int timeout) {
		Assert.isTrue(timeout >= 0, "Timeout must be a non-negative value");
		getHttpClient().getParams().setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, timeout);
	}
930303
def write(data, timeout = @timeout)
      full_size = data.bytesize

      while data.bytesize > 0
        written = socket.write_nonblock(data, exception: false)

        if written == :wait_writable
          socket.wait_writable(timeout) or fail_with_timeout!
        else
          data = data.byteslice(written..-1)
        end
      end

      full_size
    end
212500
public function setSendTimeout($timeout)
    {
        $this->sendTimeoutSec_ = floor($timeout / 1000);
        $this->sendTimeoutUsec_ =
            ($timeout - ($this->sendTimeoutSec_ * 1000)) * 1000;
    }
1029669
protected function streamSetTimeout()
    {
        $seconds = floor($this->timeout);
        $microseconds = round(($this->timeout - $seconds) * 1e6);

        return stream_set_timeout($this->resource, $seconds, $microseconds);
    }
1255766
@Override
	public void setConnectionTimeoutMS(int connectionTimeoutMS) {
    	connectionManager.getParams().setConnectionTimeout(connectionTimeoutMS);
    	http.getParams().setConnectionManagerTimeout(connectionTimeoutMS);
	}
224357
public function setRequestTimeout($timeout)
    {
        if (!is_int($timeout) || $timeout < 0) {
            throw new Exception("Invalid value supplied for request timeout: $timeout");
        }

        $this->requestTimeout = $timeout;
        return $this;
    }
874187
private void setConnectTimeout(HttpURLConnection connection) {
        try {
            Map<String, String> endpointProperties = this.api.getEndpointProperties();
            if (endpointProperties.containsKey("timeouts.connect")) { //$NON-NLS-1$
                int connectTimeoutMs = new Integer(endpointProperties.get("timeouts.connect")); //$NON-NLS-1$
                connection.setConnectTimeout(connectTimeoutMs);
            }
        } catch (Throwable t) {
        }
    }
1202132
public static function setTimeout($timeout)
	{
		self::$options[CURLOPT_TIMEOUT] = $timeout;
		self::$options[CURLOPT_CONNECTTIMEOUT] = $timeout;
	}
1226270
public function setConnectTimeout($timeout)
    {
        assert(is_int($timeout));
        assert($timeout >= 0);
        $this->_timeout = $timeout;

        return $this;
    }
283401
public void setTimeout(int timeout) {
        this.timeout = timeout;



        httpClient.connectTimeout(timeout, TimeUnit.MILLISECONDS);
        httpClient.readTimeout(timeout, TimeUnit.MILLISECONDS);
        httpClient.writeTimeout(timeout, TimeUnit.MILLISECONDS);

    }
1139502
protected function _checkSocketReadTimeout()
    {
        if ($this->socket) {
            $info = stream_get_meta_data($this->socket);
            $timedout = $info['timed_out'];
            if ($timedout) {
                $this->close();

                throw new Zend_Http_Client_Adapter_Exception(
                    "Read timed out after {$this->config['timeout']} seconds",
                    Zend_Http_Client_Adapter_Exception::READ_TIMEOUT
                );
            }
        }
    }
1356259
public function timeout($timeout = null)
    {
        if ($timeout !== null) {
            $this->lastTimeout = $timeout;
        }
        $this->ev->add($this->lastTimeout / 1e6);
    }
1127331
@Override
  public int readTimeout(byte []buf, int offset, int length, long timeout)
    throws IOException
  {
    return read(buf, offset, length);
    /*
    Socket s = _s;
      
    if (s == null) {
      return -1;
    }
    
    int oldTimeout = s.getSoTimeout();
    s.setSoTimeout((int) timeout);
    
    try {
      int result = read(buf, offset, length);
      
      if (result >= 0) {
        return result;
      }
      else if (_is == null || _is.available() < 0) {
        return -1;
      }
      else {
        return ReadBuffer.READ_TIMEOUT;
      }
    } finally {
      s.setSoTimeout(oldTimeout);
    }
    */
  }
1371105
function set_timeout($timeout) {
        if (!is_integer($timeout)) {
            if (is_numeric($timeout)) {
                $this->timeout = (integer)$timeout;
                return true;
            }
            return false;
        }
        $this->timeout = $timeout;
        return true;
    }
1067573
public function connect($timeout = null)
    {
        if ($timeout === null) {
            $timeout = intval(ini_get('default_socket_timeout'));
        }

        $this->timeout      = $timeout;
        $this->streamSocket = $this->getStream(
            $this->options->getAddress(), $timeout, $this->options->getStreamContext());
        $this->setStreamTimeout($timeout);

        $infoResponse = $this->receive();

        if ($this->isErrorResponse($infoResponse) === true) {
            throw Exception::forFailedConnection($infoResponse);
        } else {
            $this->processServerInfo($infoResponse);
            if ($this->serverInfo->isTLSRequired()) {
                set_error_handler(
                    function ($errno, $errstr, $errfile, $errline) {
                        restore_error_handler();
                        throw Exception::forFailedConnection($errstr);
                    });

                if (!stream_socket_enable_crypto(
                        $this->streamSocket, true, STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT)) {
                    throw Exception::forFailedConnection('Error negotiating crypto');
                }

                restore_error_handler();
            }
        }

        $msg = 'CONNECT '.$this->options;
        $this->send($msg);
        $this->ping();
        $pingResponse = $this->receive();

        if ($this->isErrorResponse($pingResponse) === true) {
            throw Exception::forFailedPing($pingResponse);
        }
    }