Get the ping binary.
493152
protected function makeCommand()
    {
        return sprintf(
            '%s %s',
            $this->target->resource->binary,
            $this->target->resource->command
        );
    }
1371101
private function pingExec() {
    $latency = false;

    $ttl = escapeshellcmd($this->ttl);
    $timeout = escapeshellcmd($this->timeout);
    $host = escapeshellcmd($this->host);

    // Exec string for Windows-based systems.
    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
      // -n = number of pings; -i = ttl; -w = timeout (in milliseconds).
      $exec_string = 'ping -n 1 -i ' . $ttl . ' -w ' . ($timeout * 1000) . ' ' . $host;
    }
    // Exec string for Darwin based systems (OS X).
    else if(strtoupper(PHP_OS) === 'DARWIN') {
      // -n = numeric output; -c = number of pings; -m = ttl; -t = timeout.
      $exec_string = 'ping -n -c 1 -m ' . $ttl . ' -t ' . $timeout . ' ' . $host;
    }
    // Exec string for other UNIX-based systems (Linux).
    else {
      // -n = numeric output; -c = number of pings; -t = ttl; -W = timeout
      $exec_string = 'ping -n -c 1 -t ' . $ttl . ' -W ' . $timeout . ' ' . $host . ' 2>&1';
    }

    exec($exec_string, $output, $return);

    // Strip empty lines and reorder the indexes from 0 (to make results more
    // uniform across OS versions).
    $this->commandOutput = implode($output, '');
    $output = array_values(array_filter($output));

    // If the result line in the output is not empty, parse it.
    if (!empty($output[1])) {
      // Search for a 'time' value in the result line.
      $response = preg_match("/time(?:=|<)(?<time>[\.0-9]+)(?:|\s)ms/", $output[1], $matches);

      // If there's a result and it's greater than 0, return the latency.
      if ($response > 0 && isset($matches['time'])) {
        $latency = round($matches['time']);
      }
    }

    return $latency;
  }
380754
def get_bin(self):
        
        if self._lookup_session is None:
            mgr = get_provider_manager('RESOURCE', runtime=self._runtime, proxy=self._proxy)
            self._lookup_session = mgr.get_bin_lookup_session(proxy=getattr(self, "_proxy", None))
        return self._lookup_session.get_bin(Id(self._my_map['id']))
729891
def as_bin(self):
        """"""
        f = io.BytesIO()
        self.stream(f)
        return f.getvalue()
1152434
def ping(self):
        

        if self.session.transitions.is_connected():
            yield from self._handler.mqtt_ping()
        else:
            self.logger.warning("MQTT PING request incompatible with current session state '%s'" %
                                self.session.transitions.state)
876377
def get_status(self):
        """"""
        req_url = ENDPOINTS["getStatus"].format(self.ip_address, self.zone_id)
        return request(req_url)
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
598505
def ping(self):
        """"""

        randomToken = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for x in range(32))

        r = self.doQuery('ping?data=' + randomToken)

        if r.status_code == 200:  # Query ok ?
            if r.json()['data'] == randomToken:  # Token equal ?
                return True
        return False
657237
def write_ping(self, data: bytes) -> None:
        """"""
        assert isinstance(data, bytes)
        self._write_frame(True, 0x9, data)
410980
def _bin(self, bin):  # type: (str) -> str
        
        bin_path = (self._bin_dir / bin).with_suffix(".exe" if self._is_windows else "")
        if not bin_path.exists():
            return bin

        return str(bin_path)
1033443
def Ping(self, request, context):
        
        status =  processor_pb2.Status()
        status.message='alive'
        return status
186063
def ping(self, *args, **kwargs):
        

        return self._makeApiCall(self.funcinfo["ping"], *args, **kwargs)
1156552
def get_bin_index(self, value):
        """"""
        if value == self.max_value:
            return self.num_bins - 1

        return int(self.C * log(value / self.min_value))
704144
def ping():
    '''
        
    '''
    try:
        curl_couchdb('/cozy/')
        ping = True
    except requests.exceptions.ConnectionError, error:
        print error
        ping = False
    return ping
73213
def binary(self, url, timeout=None):
        
        response = self.get_response(url, timeout=timeout)
        if response:
            return response.content
        else:
            return None
878376
public boolean ping() throws IOException {
    try (Socket s = new Socket(hostName,port); OutputStream outs = s.getOutputStream()) {
      s.setSoTimeout(timeout);
      outs.write(asBytes("zPING\0"));
      outs.flush();
      byte[] b = new byte[PONG_REPLY_LEN];
      InputStream inputStream = s.getInputStream();
      int copyIndex = 0;
      int readResult;
      do {
        readResult = inputStream.read(b, copyIndex, Math.max(b.length - copyIndex, 0));
        copyIndex += readResult;
      } while (readResult > 0);
      return Arrays.equals(b, asBytes("PONG"));
    }
  }
32210
def ping():
    '''
    
    '''
    try:
        cookie = logon()
        logout(cookie)
    except salt.exceptions.CommandExecutionError:
        return False
    except Exception as err:
        log.debug(err)
        return False
    return True