Join the server on lan.
Only available on client.
Only available to Admin.
@param string $host IPv4 with optionally a port (eg. '192.168.1.42:2350')
@param string $password
@param bool $multicall
@return bool
@throws InvalidArgumentException
189212
function joinServerLan($host, $password = '', $multicall = false)
    {
        if (!is_string($host)) {
            throw new InvalidArgumentException('host = ' . print_r($host, true));
        }
        if (!is_string($password)) {
            throw new InvalidArgumentException('password = ' . print_r($password, true));
        }

        return $this->execute(ucfirst(__FUNCTION__), array(array('Server' => $host, 'ServerPassword' => $password)), $multicall);
    }
447022
public static function setHost($host) {
        $host = rtrim($host, '/');
        if(!filter_var($host, FILTER_VALIDATE_URL)) {
            throw new \InvalidArgumentException("'$host' is not a valid URL");
        }
        self::$host = $host;
    }
723714
protected function checkConnection($host, $port)
    {
        $host = ($port == 443) ? 'ssl://' . $host : 'tcp://' . $host;

        // If the connection could not be established, fsockopen sadly does not
        // only return false (as documented), but also always issues a warning.
        if (($this->connection === null) &&
            (($this->connection = @stream_socket_client($host . ':' . $port, $errno, $errstr)) === false)) {
            // This is a bit hackisch...
            $this->connection = null;
            throw new \RuntimeException('fail');
        }
    }
500471
public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) {
    $this->host = $host;

    //  If no port value is passed, retrieve it
    if ($port == false) {
      $this->port = $this->POP3_PORT;
    } else {
      $this->port = $port;
    }

    //  If no port value is passed, retrieve it
    if ($tval == false) {
      $this->tval = $this->POP3_TIMEOUT;
    } else {
      $this->tval = $tval;
    }

    $this->do_debug = $debug_level;
    $this->username = $username;
    $this->password = $password;

    //  Refresh the error log
    $this->error = null;

    //  Connect
    $result = $this->Connect($this->host, $this->port, $this->tval);

    if ($result) {
      $login_result = $this->Login($this->username, $this->password);

      if ($login_result) {
        $this->Disconnect();

        return true;
      }

    }

    //  We need to disconnect regardless if the login succeeded
    $this->Disconnect();

    return false;
  }
880921
public static function isPortOpen($host, $port, $protocol)
    {
        $protocol = strtolower($protocol);
        
        if ($protocol != 'tcp' && $protocol != 'udp')
        {
            $errMsg = 'Unrecognized protocol [' . $protocol . '] ' . 
                      'please specify [tcp] or [udp]';
            throw new \Exception($errMsg);
        }
        
        if (empty($host))
        {
            $host = self::getPublicIp();
        }

        foreach ($ports as $port)
        {
            $connection = @fsockopen($host, $port);

            if (is_resource($connection))
            {
                $isOpen = true;
                fclose($connection);
            }

            else
            {
                $isOpen = false;
            }
        }
        
        return $isOpen;
    }
1202625
function disconnectFakePlayer($login, $multicall = false)
    {
        if (!is_string($login)) {
            throw new InvalidArgumentException('login = ' . print_r($login, true));
        }

        return $this->execute(ucfirst(__FUNCTION__), array($login), $multicall);
    }
1081536
public function check($password) {
        if (empty($password) ) {
            throw new InvalidArgumentException('The password cannot be empty');
        }
        $process = new Process($this->command);
        $process->setInput($password);
        $process->mustRun();

        return $this->verifyOutput($process->getOutput() );
    }
831015
public function connectRaw($host)
    {
        $this->type = 'raw';
        if (@inet_pton($host) === false) { // dirty check
            \PHPDaemon\Clients\DNS\Pool::getInstance()->resolve($host, function ($result) use ($host) {
                if ($result === false) {
                    Daemon::log(get_class($this) . '->connectRaw : unable to resolve hostname: ' . $host);
                    $this->onFailureEv();
                    return;
                }
                // @TODO stack of addrs
                if (is_array($result)) {
                    srand(Daemon::$process->getPid());
                    $real = $result[rand(0, sizeof($result) - 1)];
                    srand();
                } else {
                    $real = $result;
                }
                $this->connectRaw($real);
            });
            return true;
        }
        $this->hostReal = $host;
        if ($this->host === null) {
            $this->host = $this->hostReal;
        }
        $this->addr = $this->hostReal . ':raw';
        $fd = socket_create(\EventUtil::AF_INET, \EventUtil::SOCK_RAW, 1);
        if (!$fd) {
            return false;
        }
        socket_set_nonblock($fd);
        @socket_connect($fd, $host, 0);
        $this->setFd($fd);
        if (!$this->bev) {
            return false;
        }
        return true;
    }
906557
public function disconnectFromNSQD($host, $port)
    {
        $key = "$host:$port";
        if (!isset($this->nsqdTCPAddrsConnNum[$key])) {
            throw new NsqException("not connected");
        }

        foreach ($this->getConnections() as $conn) {
            if ($conn->getHost() === $host && $conn->getPort() === $port) {
                $conn->tryClose();
            }
        }
        $this->nsqdTCPAddrsConnNum[$key] = 0;
    }
50750
public function setHost($host)
	{
		//Use the provided host or use the default
		if (empty($host))
		{
			throw new Apache_Solr_InvalidArgumentException('Host parameter is empty');
		}
		else
		{
			$this->_host = $host;
		}

		if ($this->_urlsInited)
		{
			$this->_initUrls();
		}
	}
475385
protected function _connect(
        $host, $port, $timeout, $secure, $context, $retries = 0
    )
    {
        $conn = '';
        if (!strpos($host, '://')) {
            switch (strval($secure)) {
            case 'ssl':
            case 'sslv2':
            case 'sslv3':
                $conn = $secure . '://';
                $this->_secure = true;
                break;

            case 'tlsv1':
                $conn = 'tls://';
                $this->_secure = true;
                break;

            case 'tls':
            default:
                $conn = 'tcp://';
                break;
            }
        }
        $conn .= $host;
        if ($port) {
            $conn .= ':' . $port;
        }

        $this->_stream = @stream_socket_client(
            $conn,
            $error_number,
            $error_string,
            $timeout,
            STREAM_CLIENT_CONNECT,
            stream_context_create($context)
        );

        if ($this->_stream === false) {
            /* From stream_socket_client() page: a function return of false,
             * with an error code of 0, indicates a "problem initializing the
             * socket". These kind of issues are seen on the same server
             * (and even the same user account) as sucessful connections, so
             * these are likely transient issues. Retry up to 3 times in these
             * instances. */
            if (!$error_number && ($retries < 3)) {
                return $this->_connect($host, $port, $timeout, $secure, ++$retries, $context);
            }

            $e = new Client\Exception(
                'Error connecting to server.'
            );
            $e->details = sprintf("[%u] %s", $error_number, $error_string);
            throw $e;
        }

        stream_set_timeout($this->_stream, $timeout);

        if (function_exists('stream_set_read_buffer')) {
            stream_set_read_buffer($this->_stream, 0);
        }
        stream_set_write_buffer($this->_stream, 0);

        $this->_connected = true;
    }
792895
public static function connect($db, $host = 'localhost', $port = 27017)
  {
    // TODO: Use MongoDB\Driver\Manager
    self::$cnxHandler = new \MongoClient($host.':'.$port);
    self::$db = self::$cnxHandler->$db;

    if (!self::$cnxHandler || !self::$db) {
      return false;
    } else {
      return true;
    }
  }
1060670
protected function createConnection($host, $port, $methods, $callbacks)
    {
        return @ssh2_connect($host, $port, $methods, $callbacks);
    }
567737
public function connect($host, $user, $password, $database, $newLink = false)
    {
        if (!$this->pdo) {
            try {
                $this->pdo = $this->getAdapter()->connect($host, $user, $password, $database, $newLink);
                $this->setDatabase($database);
            } catch (Exception $e) {
                $e->log();
            }
        }

        return $this;
    }
988648
public static function setForcedHost($host = null)
    {
        if (! is_string($host) && ! is_null($host)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid host provided; must be an string or a null, "%s" received.',
                is_object($host) ? get_class($host) : gettype($host)
            ));
        }
        static::$forcedHost = $host;
    }
345635
public function setProxy(
        $host,
        $port,
        $ssl = false,
        $username = null,
        $password = null
    ) {
        $scheme = ($ssl ? 'https://' : 'http://');

        if ( ! is_null($username)) {
            return $this->options['proxy'] = sprintf('%s%s:%s@%s:%s', $scheme, $username, $password, $host, $port);
        }

        return $this->options['proxy'] = sprintf('%s%s:%s', $scheme, $host, $port);
    }
732179
function setCallVoteTimeOut($timeout, $multicall = false)
    {
        if (!is_int($timeout)) {
            throw new InvalidArgumentException('timeout = ' . print_r($timeout, true));
        }

        return $this->execute(ucfirst(__FUNCTION__), array($timeout), $multicall);
    }