Send one ping to the given >destIP<.
540609
def send_one_ping(mySocket, destIP, myID, mySeqNumber, packet_size):
    
    #destIP  =  socket.gethostbyname(destIP)

    # Header is type (8), code (8), checksum (16), id (16), sequence (16)
    # (packet_size - 8) - Remove header size from packet size
    myChecksum = 0

    # Make a dummy heder with a 0 checksum.
    header = struct.pack(
        "!BBHHH", ICMP_ECHO, 0, myChecksum, myID, mySeqNumber
    )

    padBytes = []
    startVal = 0x42
    # 'cose of the string/byte changes in python 2/3 we have
    # to build the data differnely for different version
    # or it will make packets with unexpected size.
    if sys.version[:1] == '2':
        bytes = struct.calcsize("d")
        data = ((packet_size - 8) - bytes) * "Q"
        data = struct.pack("d", default_timer()) + data
    else:
        for i in range(startVal, startVal + (packet_size-8)):
            padBytes += [(i & 0xff)]  # Keep chars in the 0-255 range
        #data = bytes(padBytes)
        data = bytearray(padBytes)


    # Calculate the checksum on the data and the dummy header.
    myChecksum = checksum(header + data) # Checksum is in network order

    # Now that we have the right checksum, we put that in. It's just easier
    # to make up a new header than to stuff it into the dummy.
    header = struct.pack(
        "!BBHHH", ICMP_ECHO, 0, myChecksum, myID, mySeqNumber
    )

    packet = header + data

    sendTime = default_timer()

    try:
        mySocket.sendto(packet, (destIP, 1)) # Port number is irrelevant for ICMP
    except socket.error as e:
        print("General failure (%s)" % (e.args[1]))
        return

    return sendTime
292679
def send_ping(self, payload=None):
        
        yield from asyncio.sleep(self._interval)
        self._handler.send_ping(payload=payload)
        self._start_timer(payload=payload)
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))
574186
def handle_ping(self, message_header, message):
        
        log.debug("handle ping")
        pong = Pong()
        pong.nonce = message.nonce
        log.debug("send pong")
        self.send_message(pong)
1133457
def _send_ping(self, dest_addr, payload):
        
        pkt_id = self._last_used_id

        is_ipv6 = ':' in dest_addr
        if is_ipv6:
            self._ipv6_address_present = True
            icmp_echo_request = _ICMPV6_ECHO_REQUEST
        else:
            icmp_echo_request = _ICMP_ECHO_REQUEST

        # For checksum calculation we require a dummy header, with the checksum
        # field set to zero. This header consists of:
        # - ICMP type = 8 (v4) / 128 (v6) (unsigned byte)
        # - ICMP code = 0 (unsigned byte)
        # - checksum  = 0 (unsigned short)
        # - packet id     (unsigned short)
        # - sequence  = 0 (unsigned short)  This doesn't have to be 0.
        dummy_header = bytearray(
                            struct.pack(_ICMP_HDR_PACK_FORMAT,
                                        icmp_echo_request, 0, 0,
                                        pkt_id, self.ident))

        # Calculate the checksum over the combined dummy header and payload
        checksum = self._checksum(dummy_header + payload)

        # We can now create the real header, which contains the correct
        # checksum. Need to make sure to convert checksum to network byte
        # order.
        real_header = bytearray(
                            struct.pack(_ICMP_HDR_PACK_FORMAT,
                                        icmp_echo_request, 0, checksum,
                                        pkt_id, self.ident))

        # Full packet consists of header plus payload
        full_pkt = real_header + payload

        # The full address for a sendto operation consists of the IP address
        # and a port. We don't really need a port for ICMP, so we just use 0
        # for that.
        full_dest_addr = (dest_addr, 0)

        if is_ipv6:
            socket.inet_pton(socket.AF_INET6, dest_addr)
            try:
                self._sock6.sendto(full_pkt, full_dest_addr)
            except Exception:
                # on systems without IPv6 connectivity, sendto will fail with
                # 'No route to host'
                pass
        else:
            self._sock.sendto(full_pkt, full_dest_addr)
1237150
def send(self, data):
        """"""
        self._send_data(int_to_hex(len(data)))

        self._send_data(data)
366275
def ping(self, payload=""):
        
        if isinstance(payload, six.text_type):
            payload = payload.encode("utf-8")
        self.send(payload, ABNF.OPCODE_PING)
1272218
def ping(**kwargs):
    '''
    
    '''
    status = True
    try:
        nodes(**kwargs)
    except CommandExecutionError:
        status = False

    return status
358842
def ping(self, reconnect=True):
        
        if self._sock is None:
            if reconnect:
                self.connect()
                reconnect = False
            else:
                raise err.Error("Already closed")
        try:
            self._execute_command(COMMAND.COM_PING, "")
            self._read_ok_packet()
        except Exception:
            if reconnect:
                self.connect()
                self.ping(False)
            else:
                raise
986620
protected void sendMessage(String dest, Message message) {
    if (LOG.isTraceEnabled()) {
      LOG.trace("Sends message {} to {}.",
                TextFormat.shortDebugString(message),
                dest);
    }
    this.transport.send(dest, message);
  }
728524
function transmit(sensor)
{
    var buffer = "Ping " + count;
    count++;
    console.log("Sending... " + buffer);

    sensor.sendStr(buffer, 3000);
    sensor.setSleep();
}
713537
protected void sendNextPing() {
		Set<String> nodeIDs = transporter.getAllNodeIDs();

		// Remove this node's ID
		nodeIDs.remove(nodeID);

		// Remove duplications by IP address
		int size = nodeIDs.size() * 2;
		HashSet<String> ips = new HashSet<>(size);
		Iterator<String> i = nodeIDs.iterator();
		while (i.hasNext()) {
			Tree descriptor = transporter.getDescriptor(i.next());
			if (descriptor == null) {
				continue;
			}
			Tree ipList = descriptor.get("ipList");
			if (ipList == null) {
				continue;
			}
			for (Tree ip : ipList) {
				if (ip == null) {
					continue;
				}
				String value = ip.asString();
				if (value == null || value.startsWith("127.")) {
					continue;
				}
				if (ips.contains(value)) {
					i.remove();
					break;
				}
				ips.add(value);
			}
			try {
				Thread.sleep(5);
			} catch (InterruptedException interrupt) {
				return;
			}
		}

		// Has peers?
		if (nodeIDs.isEmpty()) {
			return;
		}

		// Find the next nodeID
		boolean submitted = false;
		if (previousNodeID != null) {
			boolean found = false;
			for (String nextNodeID : nodeIDs) {
				if (previousNodeID.equals(nextNodeID)) {
					found = true;
					continue;
				}
				if (found && !nodeID.equals(nextNodeID)) {

					// Send PING to the next node
					submitted = true;
					previousNodeID = nextNodeID;
					sendPing(nextNodeID);
					break;
				}
			}
		}

		// Send PING to the first node
		if (!submitted) {
			for (String nextNodeID : nodeIDs) {
				if (!nodeID.equals(nextNodeID)) {
					previousNodeID = nextNodeID;
					sendPing(nextNodeID);
					break;
				}
			}
		}
	}
402847
def _send(self, **kwargs):
        
        if kwargs.get("dest_addr_long") is not None:
            self.zb.remote_at(**kwargs)
        else:
            self.zb.at(**kwargs)
331784
function ping (){
    clearTimeout( ping.timer );
    ping.timer = setTimeout(function(){
      b9.send({ type: 'ping', time: Date.now() });
    }, b9._interval );
  }
883013
async def __handle_ping(self, _ : Ping):
        
        self.__last_ping = time.time()
        await ZMQUtils.send(self.__backend_socket, Pong())
727508
def sendp(x, inter=0, loop=0, iface=None, iface_hint=None, count=None, verbose=None, realtime=None, *args, **kargs):
    """"""
    if iface is None and iface_hint is not None:
        iface = conf.route.route(iface_hint)[0]
    __gen_send(conf.L2socket(iface=iface, *args, **kargs), x, inter=inter, loop=loop, count=count, verbose=verbose, realtime=realtime)
818257
def ping(self, destination, length=20):
        
        print '%s call ping' % self.port
        print 'destination: %s' %destination
        try:
            cmd = 'ping %s %s' % (destination, str(length))
            print cmd
            self._sendline(cmd)
            self._expect(cmd)
            # wait echo reply
            time.sleep(1)
        except Exception, e:
            ModuleHelper.WriteIntoDebugLogger("ping() Error: " + str(e))