@param $host
@param $port

@return null|RouterServer
420118
public function findServer($host, $port)
    {
        if (isset($this->serversByHosts[$host][$port])) {
            return $this->serversByHosts[$host][$port];
        }
        
        return null;
    }
1027451
public static function create($host, $port)
  {
    $transceiver = new SocketTransceiver();
    $transceiver->createSocket($host, $port);
    
    return $transceiver;
  }
523180
function Connect($host, $port = '') {
      $this->url['scheme'] = 'http';
      $this->url['host'] = $host;
      if (zen_not_null($port)) $this->url['port'] = $port;

      return true;
    }
1184638
public static function create($host, $port)
  {
    $transceiver = new NettyFramedSocketTransceiver();
    $transceiver->createSocket($host, $port);
    
    return $transceiver;
  }
471355
public function connect($host, $port = 80, $secure = false)
    {
        // If no proxy is set, fall back to Socket adapter
        if (!$this->config['proxy_host']) {
            return parent::connect($host, $port, $secure);
        }

        /* Url might require stream context even if proxy connection doesn't */
        if ($secure) {
            $this->config['sslusecontext'] = true;
        }

        // Connect (a non-secure connection) to the proxy server
        return parent::connect(
            $this->config['proxy_host'],
            $this->config['proxy_port'],
            false
        );
    }
232243
private static function createStream(string $host, int $port)
    {
        $uri    = \sprintf('udp://%s:%d', $host, $port);
        $stream = @\stream_socket_client($uri, $errno, $errstr, 0, \STREAM_CLIENT_CONNECT);

        if (false === $stream)
        {
            throw new \RuntimeException(\sprintf('Could not connect to %s', $uri));
        }

        return $stream;
    }
519801
protected function _hasServer($host, $port)
    {
        $servers = $this->getServerList();
        foreach ($servers as $server) {
            if ($server['host'] === $host && $server['port'] === $port) {
                return true;
            }
        }

        return false;
    }
154074
protected function assembleHost(Url $host) {
		if (! $host->hasHost()) {
			$host->setHost($this->defaultHost);
		}
		
		if (preg_match('/\.sock$/i', $host->getHost())) {
			$host->removePort();
		} else if (! $host->hasPort()) {
			$host->setPort($this->defaultPort);
		}
		
		return trim($host->assemble(), '/');
	}
1031440
public static function is_port_open($host, $port)
	{
		$connection = @fsockopen($host, $port);
		if (is_resource($connection))
		{
			fclose($connection);
			return FALSE;
		}
		return TRUE;
	}
346427
public function host($host = null)
    {
        if (func_num_args() === 0) {
            $scheme = $this->_classes['scheme'];
            $port = $scheme::port($this->_scheme) !== $this->_port ? $this->_port : null;
            return ($port !== null ? "{$this->_host}:{$port}" : $this->_host);
        }
        if (strpos($host, ':')) {
            list($host, $port) = explode(':', $host);
            $this->port($port);
        }
        $this->_host = $host;
        $headers = $this->headers();
        $headers->prepend('Host', $this->host());
        return $this;
    }
712881
public static function parse_socket_options(&$options, $host = null)
    {
        if (empty($host) || empty($options)) {
            return $options;
        }

        // get rid of schema and port from the hostname
        $host_url = parse_url($host);
        if (isset($host_url['host'])) {
            $host = $host_url['host'];
        }

        // find per-host options
        if (array_key_exists($host, $options)) {
            $options = $options[$host];
        }
    }
190293
public function setRemoteSyslog($host, $port=514, $protocol='udp')
    {
        $this->syslogHost = $host;
        $this->syslogPort = $port;
        $this->syslogProtocol = $protocol;
    }
1241423
protected function _connect($host, $port)
    {
        $errorNum = 0;
        $errorStr = '';

        $remoteAddr = $this->_transport . '://' . $host . ':' . $port;

        if (!is_resource($this->_connection)) {
            $this->_connection = @stream_socket_client($remoteAddr, $errorNum, $errorStr, self::TIMEOUT);

            if ($this->_connection === false) {
                if ($errorNum == 0) {
                    throw new SMTPException(__('Unable to open socket. Unknown error'));
                } else {
                    throw new SMTPException(__('Unable to open socket. %s', array($errorStr)));
                }
            }

            if (@stream_set_timeout($this->_connection, self::TIMEOUT) === false) {
                throw new SMTPException(__('Unable to set timeout.'));
            }

            $this->helo();

            if ($this->_secure == 'tls') {
                $this->_tls();
            }

            if (($this->_user !== null) && ($this->_pass !== null)) {
                $this->_auth();
            }
        }
    }
24977
public function port($port = null)
    {
        if (func_num_args() === 1) {
            $this->_port = $port;
            return $this;
        }
        if ($this->_port !== null) {
            return $this->_port;
        }
        $scheme = $this->_classes['scheme'];
        $name = $this->scheme();

        if ($scheme::registered($name)) {
            return $scheme::port($name);
        }
    }
403643
public function useProxy($host, $port, $username = null, $password = null) {
    $this->proxy_host = $host;
    $this->proxy_port = $port;
    $this->proxy_username = $username;
    $this->proxy_password = $password;
  }
880028
function SetServer ( $host, $port = 0 )
    {
        assert ( is_string($host) );
        if ( $host[0] == '/')
        {
            $this->_path = 'unix://' . $host;
            return;
        }
        if ( substr ( $host, 0, 7 )=="unix://" )
        {
            $this->_path = $host;
            return;
        }

        $this->_host = $host;
        $port = intval($port);
        assert ( 0<=$port && $port<65536 );
        $this->_port = ( $port==0 ) ? 9312 : $port;
        $this->_path = '';
    }
1132249
public function host($host = null)
    {
        $this->host = empty($host) ? null : $host;

        return $this->host;
    }