tensor/protocol/icmp.py
def ping(dst, count, inter=0.2, maxwait=1000, size=64):
    """Sends ICMP echo requests to destination `dst` `count` times.
    Returns a deferred which fires when responses are finished.
    """
    def _then(result, p):
        p.stopListening()
        return result

    d = defer.Deferred()
    p = ICMPPort(0, ICMPPing(d, dst, count, inter, maxwait, size), "", 8192, reactor)
    p.startListening()

    return d.addCallback(_then, p)
def ping(dst, count, inter=0.2, maxwait=1000, size=64):
    """Sends ICMP echo requests to destination `dst` `count` times.
    Returns a deferred which fires when responses are finished.
    """
    def _then(result, p):
        p.stopListening()
        return result

    d = defer.Deferred()
    p = ICMPPort(0, ICMPPing(d, dst, count, inter, maxwait, size), "", 8192, reactor)
    p.startListening()

    return d.addCallback(_then, p)
Sends ICMP echo requests to destination `dst` `count` times.
    Returns a deferred which fires when responses are finished.