pingback.ping(sourceURI, targetURI) => 'Pingback message'

    Notifies the server that a link has been added to sourceURI,
    pointing to targetURI.

    See: http://hixie.ch/specs/pingback/pingback-1.0
162576
def pingback_ping(source, target):
    
    try:
        if source == target:
            return UNDEFINED_ERROR

        site = Site.objects.get_current()
        try:
            document = ''.join(map(
                lambda byte_line: byte_line.decode('utf-8'),
                urlopen(source).readlines()))
        except (HTTPError, URLError):
            return SOURCE_DOES_NOT_EXIST

        if target not in document:
            return SOURCE_DOES_NOT_LINK

        target_splitted = urlsplit(target)
        if target_splitted.netloc != site.domain:
            return TARGET_DOES_NOT_EXIST

        try:
            view, args, kwargs = resolve(target_splitted.path)
        except Resolver404:
            return TARGET_DOES_NOT_EXIST

        try:
            entry = Entry.published.get(
                slug=kwargs['slug'],
                publication_date__year=kwargs['year'],
                publication_date__month=kwargs['month'],
                publication_date__day=kwargs['day'])
            if not entry.pingbacks_are_open:
                return TARGET_IS_NOT_PINGABLE
        except (KeyError, Entry.DoesNotExist):
            return TARGET_IS_NOT_PINGABLE

        soup = BeautifulSoup(document, 'html.parser')
        title = six.text_type(soup.find('title'))
        title = title and strip_tags(title) or _('No title')
        description = generate_pingback_content(soup, target,
                                                PINGBACK_CONTENT_LENGTH)

        pingback_klass = comments.get_model()
        pingback_datas = {
            'content_type': ContentType.objects.get_for_model(Entry),
            'object_pk': entry.pk,
            'site': site,
            'user_url': source,
            'user_name': title,
            'comment': description
        }
        pingback = pingback_klass(**pingback_datas)
        if check_is_spam(pingback, entry, FakeRequest()):
            return PINGBACK_IS_SPAM

        pingback_defaults = {'comment': pingback_datas.pop('comment'),
                             'user_name': pingback_datas.pop('user_name')}
        pingback, created = pingback_klass.objects.get_or_create(
            defaults=pingback_defaults,
            **pingback_datas)
        if created:
            pingback.flags.create(user=get_user_flagger(), flag=PINGBACK)
            pingback_was_posted.send(pingback.__class__,
                                     pingback=pingback,
                                     entry=entry)
            return 'Pingback from %s to %s registered.' % (source, target)
        return PINGBACK_ALREADY_REGISTERED
    except Exception:
        return UNDEFINED_ERROR
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
313510
function ping (host, callback) {
  var isWin = process.platform.indexOf('win') === 0; // win32 or win64
  var arg = isWin ? '-n' : '-c';
  var pong = spawn('ping', [arg, '3', host]); // only ping 3 times

  pong.on('error', function onerror (error) {
    callback(error, false);
    pong.kill();
  });

  pong.stdout.on('data', function stdoutdata (data) {
    callback(false, data.toString().split('\n')[0].substr(14));
    pong.kill();
  });

  pong.stderr.on('data', function stderrdata (data) {
    callback(new Error(data.toString().split('\n')[0].substr(14)), false);
    pong.kill();
  });
}
883013
async def __handle_ping(self, _ : Ping):
        
        self.__last_ping = time.time()
        await ZMQUtils.send(self.__backend_socket, Pong())
590842
function PingppResource(pingpp, urlData) {
  this._pingpp = pingpp;
  this._urlData = urlData || {};

  this.basePath = utils.makeURLInterpolator(pingpp.getApiField('basePath'));
  this.path = utils.makeURLInterpolator(this.path);

  if (this.includeBasic) {
    this.includeBasic.forEach(function(methodName) {
      this[methodName] = PingppResource.BASIC_METHODS[methodName];
    }, this);
  }

  this.initialize.apply(this, arguments);
}
16607
def ping(proxy=None, hostport=None):
    
    schema = {
        'type': 'object',
        'properties': {
            'status': {
                'type': 'string'
            },
        },
        'required': [
            'status'
        ]
    }

    assert proxy or hostport, 'Need either proxy handle or hostport string'
    if proxy is None:
        proxy = connect_hostport(hostport)

    resp = {}

    try:
        resp = proxy.ping()
        resp = json_validate( schema, resp )
        if json_is_error(resp):
            return resp

        assert resp['status'] == 'alive'

    except ValidationError as e:
        if BLOCKSTACK_DEBUG:
            log.exception(e)

        resp = {'error': 'Server response did not match expected schema.  You are likely communicating with an out-of-date Blockstack node.', 'http_status': 502}
        return resp

    except socket.timeout:
        log.error("Connection timed out")
        resp = {'error': 'Connection to remote host timed out.', 'http_status': 503}
        return resp

    except socket.error as se:
        log.error("Connection error {}".format(se.errno))
        resp = {'error': 'Connection to remote host failed.', 'http_status': 502}
        return resp

    except Exception as ee:
        if BLOCKSTACK_DEBUG:
            log.exception(ee)

        log.error("Caught exception while connecting to Blockstack node: {}".format(ee))
        resp = {'error': 'Failed to contact Blockstack node.  Try again with `--debug`.', 'http_status': 500}
        return resp

    return resp
757794
void ping(final HttpServerExchange exchange, final NodePingUtil.PingCallback callback) {
        NodePingUtil.pingNode(this, exchange, callback);
    }
948210
@Override
    boolean ping_i(final boolean fwd) {
	if (proxy == null) {
	    return false;
	}
	try {
	    proxy.ping();
	} catch (final DevFailed df) {
	    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
714912
function probeServer(address, port, callback) {
    address = address || 'localhost';
    port    = port || 443;

    pingServer({
        address:  address,
        port:     port,
        attempts: 1,
        timeout:  5000
    }, function(err, data) {
        var available = data.min !== undefined;
        callback(err, available);
    });
}
603406
def attachments_ping(request):
    
    # Do nothing if server is readonly.
    if asbool(request.registry.settings.get('readonly', False)):
        return True

    # We will fake a file upload, so pick a file extension that is allowed.
    extensions = request.attachment.extensions or {'json'}
    allowed_extension = "." + list(extensions)[-1]

    status = False
    try:
        content = cgi.FieldStorage()
        content.filename = HEARTBEAT_FILENAME + allowed_extension
        content.file = BytesIO(HEARTBEAT_CONTENT.encode('utf-8'))
        content.type = 'application/octet-stream'

        stored = utils.save_file(request, content, keep_link=False, replace=True)

        relative_location = stored['location'].replace(request.attachment.base_url, '')
        request.attachment.delete(relative_location)

        status = True
    except Exception as e:
        logger.exception(e)
    return status
1272218
def ping(**kwargs):
    '''
    
    '''
    status = True
    try:
        nodes(**kwargs)
    except CommandExecutionError:
        status = False

    return status
1346344
@RequestMapping(method = POST)
    public String ping(@Valid @RequestBody PingPayload payload) {
        logger.info("received Ping event - {}", payload);
        return payload.getZen();
    }
821359
function Ping(url, driver) {
  if (!(this instanceof Ping)) {
    return new Ping(url, driver);
  }

  driver = driver || request;

  this.url = url;
  this.driver = driver;
  this.successCodes = SUCCESS;
  this.started = false;
  this.validators = [];
  var self = this;

  var textCheck = function(err, res, body) {
    if (!self._text) return true;
    return ~body.indexOf(self._text);
  };

  var errorCheck = function(err, res) {
    return !err;
  };

  var statusCheck = function(err, res, body) {
    // If there is no result from the server, assume site is down.
    if (!res){
      return false;
    } else {
      return ~self.successCodes.indexOf(res.statusCode);
    }
  };

  var perfCheck = function(err, res, body, info) {
    if (typeof self._maxDuration !== 'number') return true;
    return info.duration <= self._maxDuration;
  };

  this.register(errorCheck, statusCheck, textCheck, perfCheck);
}
781707
function ping() {
        var value = +new Date();

        primus.timers.clear('ping');
        primus._write('primus::ping::'+ value);
        primus.emit('outgoing::ping', value);
        primus.timers.setTimeout('pong', pong, primus.options.pong);
      }
1328948
public void ping(long id, long timeout, PingCallback callback) {
        pingCallbacks.put(id, callback);
        scheduller.postMessage(new MTPing(id), false, timeout);
        actionsActor.send(new PingTimeout(id), timeout);
    }
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)