Set the host for a lightning server.

        Host can be local (e.g. http://localhost:3000), a heroku
        instance (e.g. http://lightning-test.herokuapp.com), or
        a independently hosted lightning server.
480617
def set_host(self, host):
        
        if host[-1] == '/':
            host = host[:-1]

        self.host = host
        return self
101159
def setup_backend(
    serve=True,
    host=DEFAULT_HOST,
    port=DEFAULT_PORT,
    debug=False,
    open_browser=True,
    browsername=None,
    testing=False,
    private_key=None,
    certificate=None,
    LLDB=False,
):
    """"""
    app.config["LLDB"] = LLDB

    kwargs = {}
    ssl_context = get_ssl_context(private_key, certificate)
    if ssl_context:
        # got valid ssl context
        # force everything through https
        SSLify(app)
        # pass ssl_context to flask
        kwargs["ssl_context"] = ssl_context

    url = "%s:%s" % (host, port)
    if kwargs.get("ssl_context"):
        protocol = "https://"
        url_with_prefix = "https://" + url
    else:
        protocol = "http://"
        url_with_prefix = "http://" + url

    if debug:
        async_mode = "eventlet"
    else:
        async_mode = "gevent"

    socketio.server_options["async_mode"] = async_mode
    try:
        socketio.init_app(app)
    except Exception:
        print(
            'failed to initialize socketio app with async mode "%s". Continuing with async mode "threading".'
            % async_mode
        )
        socketio.server_options["async_mode"] = "threading"
        socketio.init_app(app)

    if testing is False:
        if host == DEFAULT_HOST:
            url = (DEFAULT_HOST, port)
        else:
            try:
                url = (socket.gethostbyname(socket.gethostname()), port)
            except Exception:
                url = (host, port)

        if open_browser is True and debug is False:
            browsertext = repr(browsername) if browsername else "default browser"
            args = (browsertext,) + url
            text = ("Opening gdbgui with %s at " + protocol + "%s:%d") % args
            print(colorize(text))
            b = webbrowser.get(browsername) if browsername else webbrowser
            b.open(url_with_prefix)
        else:
            print(colorize("View gdbgui at %s%s:%d" % (protocol, url[0], url[1])))

        print("exit gdbgui by pressing CTRL+C")

        try:
            socketio.run(
                app,
                debug=debug,
                port=int(port),
                host=host,
                extra_files=get_extra_files(),
                **kwargs
            )
        except KeyboardInterrupt:
            # Process was interrupted by ctrl+c on keyboard, show message
            pass
117223
def apply_config(self, config):
        
        self.hosts = config["hosts"]
        old_base_path = self.base_path
        self.base_path = config["path"]
        if not self.connected.is_set():
            return

        logger.debug("Setting ZK hosts to %s", self.hosts)
        self.client.set_hosts(",".join(self.hosts))

        if old_base_path and old_base_path != self.base_path:
            logger.critical(
                "ZNode base path changed!" +
                " Lighthouse will need to be restarted" +
                " to watch the right znodes"
            )
197225
protected boolean setConnector() {
    if (this.host == null) {
      log.error("No host value set, cannot set up socket connector.");
      return false;
    }
    if (this.port < 0 || this.port > 65535) {
      log.error("Port value is invalid {}.", Integer.valueOf(this.port));
      return false;
    }
    if (this.executors == null) {
      this.executors = new ExecutorFilter(1);
    }

    this.connector = new NioSocketConnector();
    this.connector.getSessionConfig().setIdleTime(IdleStatus.WRITER_IDLE,
        ClientWorldModelInterface.TIMEOUT_PERIOD / 2);
//    this.connector.getSessionConfig().setIdleTime(IdleStatus.READER_IDLE,
//        (int) (ClientWorldModelInterface.TIMEOUT_PERIOD * 1.1f));
    if (!this.connector.getFilterChain().contains(
        WorldModelClientProtocolCodecFactory.CODEC_NAME)) {
      this.connector.getFilterChain().addLast(
          WorldModelClientProtocolCodecFactory.CODEC_NAME,
          new ProtocolCodecFilter(
              new WorldModelClientProtocolCodecFactory(true)));
    }
    this.connector.getFilterChain().addLast("ExecutorPool", this.executors);
    this.connector.setHandler(this.ioHandler);
    log.debug("Connector set up successful.");
    return true;
  }
762742
def set_url (self, url):
        """"""
        self.url = url
        self.host, self.path = urlparse.urlparse(url)[1:3]
1171266
def __set_proxy(self, config):
        
        if "proxy" in config and config["proxy"]:
            proxy = config["proxy"]
            splitted = proxy.split(':')
            if len(splitted) != 2:
                raise ValueError(ONEVIEW_CLIENT_INVALID_PROXY)

            proxy_host = splitted[0]
            proxy_port = int(splitted[1])
            self.__connection.set_proxy(proxy_host, proxy_port)
1222200
def bootstrap(self):
        
        cmd = ["heroku", "apps:create", self.name, "--buildpack", "heroku/python"]

        # If a team is specified, assign the app to the team.
        if self.team:
            cmd.extend(["--team", self.team])

        self._run(cmd)
        # Set HOST value
        self.set_multiple(
            HOST=self.url, CREATOR=self.login_name(), DALLINGER_UID=self.dallinger_uid
        )
512084
def register_host():
    """"""
    pyblish.api.register_host("hython")
    pyblish.api.register_host("hpython")
    pyblish.api.register_host("houdini")
1086856
private void setupHost(ListItemHostWidget host, Widget view, final int dataIndex) {
        boolean selected = setupView(view, dataIndex);
        host.setGuest(view, dataIndex);
        host.setSelected(selected);
        host.requestLayout();

        if (mContent.getChildren().contains(host)) {
            Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "setupItem(%s): added item(%s) at dataIndex [%d]",
                    getName(), view.getName(), dataIndex);
        } else {
            Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "setupItem(%s): reuse item(%s) at dataIndex [%d]",
                    getName(), view.getName(), dataIndex);
        }
    }
457150
def set_hostname(self, userid, hostname, os_version):
        
        tmp_path = self._pathutils.get_guest_temp_path(userid)
        if not os.path.exists(tmp_path):
            os.makedirs(tmp_path)
        tmp_file = tmp_path + '/hostname.sh'

        lnxdist = self._dist_manager.get_linux_dist(os_version)()
        lines = lnxdist.generate_set_hostname_script(hostname)
        with open(tmp_file, 'w') as f:
            f.writelines(lines)

        requestData = "ChangeVM " + userid + " punchfile " + \
                            tmp_file + " --class x"
        LOG.debug("Punch script to guest %s to set hostname" % userid)

        try:
            self._smtclient._request(requestData)
        except exception.SDKSMTRequestFailed as err:
            msg = ("Failed to punch set_hostname script to userid '%s'. SMT "
                   "error: %s" % (userid, err.format_message()))
            LOG.error(msg)
            raise exception.SDKSMTRequestFailed(err.results, msg)
        finally:
            self._pathutils.clean_temp_folder(tmp_path)
945543
def serve(config):
    ""
    from gevent.pywsgi import WSGIServer

    app = make_app(config=config)

    host = app.config.get("HOST", '127.0.0.1')
    port = app.config.get("PORT", 5000)
    http_server = WSGIServer((host, port), app)
    http_server.serve_forever()
1180759
def host_is_local(hostname, port=22): # no port specified, just use the ssh port
    
    hostname = socket.getfqdn(hostname)
    if hostname in ("localhost", "0.0.0.0", "127.0.0.1", "1.0.0.127.in-addr.arpa",
                    "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"):
        return True
    localhost = socket.gethostname()
    if hostname == localhost:
        return True
    localaddrs = socket.getaddrinfo(localhost, port)
    targetaddrs = socket.getaddrinfo(hostname, port)
    for (ignored_family, ignored_socktype, ignored_proto, ignored_canonname,
         sockaddr) in localaddrs:
        for (ignored_rfamily, ignored_rsocktype, ignored_rproto,
             ignored_rcanonname, rsockaddr) in targetaddrs:
            if rsockaddr[0] == sockaddr[0]:
                return True
    return False
673090
def configure(conf)
      super
      @host = conf['host']
      @port = conf['port']
      @token = conf['token']
      @hostname = conf['hostname'] || Socket.gethostname.split('.').first

      # Determine mapping of record keys to syslog keys
      @mappings = {}
      SYSLOG_HEADERS.each do |key_name|
        conf_key = "#{key_name}_key"
        @mappings[key_name] = conf[conf_key] if conf.key?(conf_key)
      end
    end
636181
function localhost(local, defaultPort) {
  // edge case when hostname:port is not informed via cli
  if (local === undefined || local === 'true') {
    local = [defaultPort];
  } else {
    local = local.toString().split(':');
  }

  return {
    hostname: reIp.test(local[0]) || isNaN(parseInt(local[0], 10)) &&
      local[0] ? local[0] : os.hostname(),
    port: parseInt(local[1] || (!reIp.test(local[0]) && local[0]), 10) ||
      defaultPort
  };
}
970078
function checkHost(host,callback) {

	if(hostCache.get(host,callback)) {
		console.log('checkHost: Resolved %s from hostCache...',host);
		return true;
	}

	console.log('checkHost: Looking up %s...',host);

	var options = {
		host: host,
		port: 80,
		path: '/',
		method: 'GET'
	};

	var req = http.request(options, function(res) {
		var data = '';
		res.setEncoding('utf8');

		res.on('data', function (chunk) {
			data += chunk;
		});
		res.on('end', function () {
			hostCache.set(host,true);
		});
		res.on('error',function() {
			hostCache.set(host,false);
		});
	});
	req.on('error',function() {
		hostCache.set(host,false);
	});
	req.end();
}
697967
def serve(application, host='127.0.0.1', port=8080):
	
	
	# Instantiate the server with a bound port and with our application.
	server(listen(host, int(port)), application)
221716
public boolean setMasterHostFail() {
    if (masterHostFail.compareAndSet(false, true)) {
      masterHostFailNanos = System.nanoTime();
      currentConnectionAttempts.set(0);
      return true;
    }
    return false;
  }