Set the host for this URI. If null is passed in, the userinfo
field is also set to null and the port is set to -1.

@param p_host the host for this URI

@throws MalformedURIException if p_host is not a valid IP
address or DNS hostname.
358731
public void setHost(String p_host) throws MalformedURIException
  {

    if (p_host == null || p_host.trim().length() == 0)
    {
      m_host = p_host;
      m_userinfo = null;
      m_port = -1;
    }
    else if (!isWellFormedAddress(p_host))
    {
      throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
    }

    m_host = p_host;
  }
850016
public void setHttpProxy(String host) {
    setProxyValue(HTTP_SERVER, host);
    setProxyValue(USE_HTTP, host != null);
  }
371467
public void setHost( String host )
    {
        _host = null;
        if ( host != null && host.length() > 0 )
        {
            //
            // Here's some very minimal support for IPv6 addresses.
            // If the literal IPv6 address is not enclosed in square brackets
            // then add them.
            //
            boolean needBrackets = ( ( host.indexOf( ':' ) >= 0 )
                    && !host.startsWith( "[" )
                    && !host.endsWith( "]" ) );

            if ( needBrackets )
            {
                _host = '[' + host + ']';
            }
            else
            {
                _host = host;
            }

            _opaque = false;
            setSchemeSpecificPart( null );
        }

        if ( _host == null )
        {
            setUserInfo( null );
            setPort( UNDEFINED_PORT );
        }
    }
349271
private function isUriWithSchemeHostAndPathOnly()
    {
        return null === $this->user_info
            && null === $this->port
            && null === $this->query
            && null === $this->fragment
            && !('' != $this->scheme && null === $this->host);
    }
1094788
public void setServerAddress(int serverAddress) throws ModbusNumberException {
        if (!Modbus.checkServerAddress(serverAddress))
            throw new ModbusNumberException("Error in slave id", serverAddress);
        this.serverAddress = serverAddress;
    }
1077044
private function updateHostFromUri()
    {
        $host = $this->uri->getHost();

        if ($host == '') {
            return;
        }

        if (($port = $this->uri->getPort()) !== null) {
            $host .= ':' . $port;
        }

        $this->setHeader('Host', $host);
    }
995668
public static void setDnsCache(long expireMillis, String host, String... ips) {
        try {
            InetAddressCacheUtil.setInetAddressCache(host, ips, System.currentTimeMillis() + expireMillis);
        } catch (Exception e) {
            final String message = String.format("Fail to setDnsCache for host %s ip %s expireMillis %s, cause: %s",
                    host, Arrays.toString(ips), expireMillis, e.toString());
            throw new DnsCacheManipulatorException(message, e);
        }
    }
440922
@Deprecated
    public RpcInternalContext setLocalAddress(String host, int port) {
        if (host == null) {
            return this;
        }
        if (port < 0 || port > 0xFFFF) {
            port = 0;
        }
        // 提前检查是否为空，防止createUnresolved抛出异常，损耗性能
        this.localAddress = InetSocketAddress.createUnresolved(host, port);
        return this;
    }
312613
public void setSocketAddr(String name, InetSocketAddress addr) {
		set(name, NetUtils.getHostPortString(addr));
	}
579546
public HostPort setPassive() throws IOException, ServerException {
        Reply reply = null;
        try {
            reply = controlChannel.execute(
                    (controlChannel.isIPv6()) ? Command.EPSV : Command.PASV);
        } catch (UnexpectedReplyCodeException urce) {
            throw ServerException.embedUnexpectedReplyCodeException(urce);
        } catch (FTPReplyParseException rpe) {
            throw ServerException.embedFTPReplyParseException(rpe);
        }
        String pasvReplyMsg = null;

        pasvReplyMsg = reply.getMessage();

        int openBracket = pasvReplyMsg.indexOf("(");
        int closeBracket = pasvReplyMsg.indexOf(")", openBracket);
        String bracketContent =
            pasvReplyMsg.substring(openBracket + 1, closeBracket);

        this.session.serverMode = Session.SERVER_PASSIVE;

        HostPort hp = null;
        if (controlChannel.isIPv6()) {
            hp = new HostPort6(bracketContent);
            // since host information might be null
            // fill it it
            if (hp.getHost() == null) {
                ((HostPort6)hp).setVersion(HostPort6.IPv6);
                ((HostPort6)hp).setHost(controlChannel.getHost());
            }
        } else {
            hp = new HostPort(bracketContent);
        }

        this.session.serverAddress = hp;
        return hp;
    }
653068
public static InetSocketAddress createSocketAddr(String target, int defaultPort) {
		int colonIndex = target.indexOf(':');
		if (colonIndex < 0 && defaultPort == -1) {
			throw new RuntimeException("Not a host:port pair: " + target);
		}
		String hostname = "";
		int port = -1;
		if (!target.contains("/")) {
			if (colonIndex == -1) {
				hostname = target;
			} else {
				// must be the old style <host>:<port>
				hostname = target.substring(0, colonIndex);
				port = Integer.parseInt(target.substring(colonIndex + 1));
			}
		} else {
			// a new uri
			try {
				URI addr = new URI(target);
				hostname = addr.getHost();
				port = addr.getPort();
			} catch (URISyntaxException use) {
				LOG.fatal(use);
			}
		}

		if (port == -1) {
			port = defaultPort;
		}

		if (getStaticResolution(hostname) != null) {
			hostname = getStaticResolution(hostname);
		}
		return new InetSocketAddress(hostname, port);
	}
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 = '';
    }
783571
def set_default_host(cls, value):
        
        if value is None:
            cls.DEFAULT_HOST = "http://127.0.0.1:80"
        else:
            scheme, host, port = get_hostname_parameters_from_url(value)
            cls.DEFAULT_HOST = "%s://%s:%s" % (scheme, host, port)
183715
private void vaildateHostPort(String host, String port)
    {
        if (host == null || !StringUtils.isNumeric(port) || port.isEmpty())
        {
            logger.error("Host or port should not be null / port should be numeric");
            throw new IllegalArgumentException("Host or port should not be null / port should be numeric");
        }
    }
681505
public static void setDefaultHostName(String hostName) {
        if (hostName == null || hostName.contains(":")) {
            return;
        }
        DEFAULT_BASE_URL = "http://" + hostName + ":" + DEFAULT_API_PORT + "/" + API_BASE + "/";
    }
735660
public void setParameter(String name, String value) {
		String escapedValue = RFC2396UrlDecoder.encode(value);
		super.setParameter(name, value);
		try {
		    // https://code.google.com/p/sipservlets/issues/detail?id=170
			telUrl.setParameter(name, "".equals(escapedValue) ? null : escapedValue);
		} catch (ParseException e) {
			throw new IllegalArgumentException("Problem setting parameter", e);
		}
	}
459755
public void setDestinationUri(URI uri) {
        if (EventUtils.isEmptyOrNull(uri)) {
            LOGGER.error("The destination URI cannot be null");
            throw new IllegalArgumentException("The destination URI cannot be null");
        }

        // Try determining the host address
        InetAddress address;
        try {
            address = InetAddress.getByName(uri.getHost());
        } catch (Exception e) {
            LOGGER.error("The specified address could not be resolved");
            throw new IllegalArgumentException("The specified address could not be resolved");
        }

        setDestinationAddress(address);

        // Try determining the port
        int port = uri.getPort();
        if (port == -1) {
            LOGGER.warn("Invalid port specified in URI, using transport default port");
            port = AuditorModuleConfig.AUDITOR_AUDIT_REPOSITORY_DEFAULT_PORT;
        }

        setDestinationPort(port);
    }