Tell whether the server is running by pinging it as a client.
971600
public static boolean pingServer(String protocol, String user, String pass) {
        try {
            getServerResponse(protocol, user, pass, "/describe");
            return true;
        } catch (Exception e) {
            logger.debug("Assuming the server isn't running because "
                    + "describe request failed", e);
            return false;
        }
    }
649164
def get_status(address=None):
    
    address = address or (config.dbserver.host, DBSERVER_PORT)
    return 'running' if socket_ready(address) else 'not-running'
885149
def on_ping(self, data):
        
        self.log.debug('jupyter_server_proxy: on_ping: {}'.format(data))
        self._record_activity()
        if hasattr(self, 'ws'):
            self.ws.protocol.write_ping(data)
730488
def check_keepalive(self):
        """"""
        if self.sock != NC.INVALID_SOCKET and time.time() - self.last_msg_out >= self.keep_alive:
            if self.state == NC.CS_CONNECTED:
                self.send_pingreq()
            else:
                self.socket_close()
23979
def is_running(self) -> bool:
        """"""
        if self._proc is None or self._proc.returncode is not None:
            return False
        return True
913389
def ping():
    '''
    
    '''
    try:
        out, err = DETAILS['server'].sendline('help')
        return True
    except TerminalException as e:
        log.error(e)
        return False
264261
function pingServer(_self, _server, cb) {
      // Measure running time
      var start = new Date().getTime();

      // Emit the server heartbeat start
      emitSDAMEvent(self, 'serverHeartbeatStarted', { connectionId: _server.name });

      // Execute ismaster
      _server.command(
        'admin.$cmd',
        {
          ismaster: true
        },
        {
          monitoring: true,
          socketTimeout: self.s.options.connectionTimeout || 2000
        },
        function(err, r) {
          if (self.state === DESTROYED || self.state === UNREFERENCED) {
            // Move from connectingProxies
            moveServerFrom(self.connectedProxies, self.disconnectedProxies, _server);
            _server.destroy();
            return cb(err, r);
          }

          // Calculate latency
          var latencyMS = new Date().getTime() - start;

          // We had an error, remove it from the state
          if (err) {
            // Emit the server heartbeat failure
            emitSDAMEvent(self, 'serverHeartbeatFailed', {
              durationMS: latencyMS,
              failure: err,
              connectionId: _server.name
            });
            // Move from connected proxies to disconnected proxies
            moveServerFrom(self.connectedProxies, self.disconnectedProxies, _server);
          } else {
            // Update the server ismaster
            _server.ismaster = r.result;
            _server.lastIsMasterMS = latencyMS;

            // Server heart beat event
            emitSDAMEvent(self, 'serverHeartbeatSucceeded', {
              durationMS: latencyMS,
              reply: r.result,
              connectionId: _server.name
            });
          }

          cb(err, r);
        }
      );
    }
606285
function ping(options, callback) {
  const args = utils.getArgs(options, [config], callback);
  const url = `http://${args.options.ip}:${args.options.port}/ping`;

  return request.get(url, function(err) {
    if (err) {
      if (err.code === "ECONNREFUSED") {
        return args.callback(null, { running: false });
      }
      return args.callback(err);
    }
    return args.callback(null, { running: true });
  });
}
1130217
def ping(self, event):
        """"""

        self.log('Client ping received:', event.data, lvl=verbose)
        response = {
            'component': 'hfos.ui.clientmanager',
            'action': 'pong',
            'data': [event.data, time() * 1000]
        }

        self.fire(send(event.client.uuid, response))
526265
def start(self):
        """"""
        msg = ''
        if not self.running():
            if self._port == 0:
                self._port = _port_not_in_use()
            self._process = start_server_background(self._port)
        else:
            msg = 'Server already started\n'
        msg += 'Server running at {}'.format(self.url())
        print(msg)
996094
async def _pinger(self):
        '''
        

        '''
        async def _do_ping():
            try:
                await pinger_facade.Ping()
                await asyncio.sleep(10, loop=self.loop)
            except CancelledError:
                pass

        pinger_facade = client.PingerFacade.from_connection(self)
        try:
            while True:
                await utils.run_with_interrupt(
                    _do_ping(),
                    self.monitor.close_called,
                    loop=self.loop)
                if self.monitor.close_called.is_set():
                    break
        except websockets.exceptions.ConnectionClosed:
            # The connection has closed - we can't do anything
            # more until the connection is restarted.
            log.debug('ping failed because of closed connection')
            pass
733552
def ping():
    '''
    
    '''
    r = salt.utils.http.query(DETAILS['url']+'ping', decode_type='json', decode=True)
    try:
        return r['dict'].get('ret', False)
    except Exception:
        return False
1146260
def ping(self):
        
        msg_code = riak.pb.messages.MSG_CODE_PING_REQ
        codec = self._get_codec(msg_code)
        msg = codec.encode_ping()
        resp_code, _ = self._request(msg, codec)
        if resp_code == riak.pb.messages.MSG_CODE_PING_RESP:
            return True
        else:
            return False
820943
def is_running(self):
        
        if self.block:
            return False

        return self.thread.is_alive() or self.process.poll() is None
1033785
def is_running(self):
        
        self.__update_status()
        return self.status == Status.UP or self.status == Status.DECOMMISSIONED
85367
def is_internet_on(host="8.8.8.8", port=53, timeout=3):
    
    socket.setdefaulttimeout(timeout)
    socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((host, port))
935114
def client_status(self, config_path):
        """"""
        c = self.client_for(config_path)
        status = "stopped"
        if not c or not c.ensime:
            status = 'unloaded'
        elif c.ensime.is_ready():
            status = 'ready'
        elif c.ensime.is_running():
            status = 'startup'
        elif c.ensime.aborted():
            status = 'aborted'
        return status