def verbose_ping(dest_addr, timeout=2, count=4, interval=1.0):
    """
    Send >count< ping to >dest_addr< with the given >timeout< and display
    the result.
    """
    ping_succeeded = False
    for i in xrange(count):
        print("ping %s..." % dest_addr, end=' ')
        try:
            delay = do_one(dest_addr, timeout)
        except socket.gaierror as e:
            print("failed. (socket error: '%s')" % e[1])
            break

        if delay is None:
            print("failed. (timeout within %ssec.)" % timeout)
        else:
            time.sleep(min(0, interval - delay))
            print("got ping in %0.4fms\n" % (delay * 1000))
            ping_succeeded = True
    return ping_succeeded

    Send >count< ping to >dest_addr< with the given >timeout< and display
    the result.
    
bin/ping.py