/** * This method is used to ping a remote host to test for ICMP support. If * the remote host responds within the specified period, defined by retries * and timeouts, then the response time is returned. * * @param host * The address to poll. * @param timeout * The time to wait between each retry. * @param retries * The number of times to retry * @return The response time in microseconds if the host is reachable and has responded with an echo reply, otherwise a null value. * @throws InterruptedException if any. * @throws IOException if any. * @throws java.lang.Exception if any. */ @Override public Number ping(final InetAddress host, final long timeout, final int retries, final int packetsize) throws Exception { final SinglePingResponseCallback cb = new SinglePingResponseCallback(host); ping(host, timeout, retries, packetsize, 1, cb); cb.waitFor(); cb.rethrowError(); return cb.getResponseTime(); }
/** * This method is used to ping a remote host to test for ICMP support. If * the remote host responds within the specified period, defined by retries * and timeouts, then the response time is returned. * * @param host * The address to poll. * @param timeout * The time to wait between each retry. * @param retries * The number of times to retry * @return The response time in microseconds if the host is reachable and has responded with an echo reply, otherwise a null value. * @throws InterruptedException if any. * @throws IOException if any. * @throws java.lang.Exception if any. */ @Override public Number ping(final InetAddress host, final long timeout, final int retries, final int packetsize) throws Exception { final SinglePingResponseCallback cb = new SinglePingResponseCallback(host); ping(host, timeout, retries, packetsize,(short)1, cb); cb.waitFor(); cb.rethrowError(); return cb.getResponseTime(); }
/** * This method is used to ping a remote host to test for ICMP support. If * the remote host responds within the specified period, defined by retries * and timeouts, then the response time is returned. * * @param host * The address to poll. * @param timeout * The time to wait between each retry. * @param retries * The number of times to retry * @return The response time in microseconds if the host is reachable and has responded with an echo reply, otherwise a null value. * @throws InterruptedException if any. * @throws IOException if any. * @throws java.lang.Exception if any. */ @Override public Number ping(final InetAddress host, final long timeout, final int retries, final int packetsize) throws Exception { final SinglePingResponseCallback cb = new SinglePingResponseCallback(host); ping(host, timeout, retries, packetsize, (short)1, cb); cb.waitFor(); cb.rethrowError(); return cb.getResponseTime(); }
/** * This method is used to ping a remote host to test for ICMP support. If * the remote host responds within the specified period, defined by retries * and timeouts, then the response time is returned. * * @param host * The address to poll. * @param timeout * The time to wait between each retry. * @param retries * The number of times to retry * @return The response time in microseconds if the host is reachable and has responded with an echo reply, otherwise a null value. * @throws InterruptedException if any. * @throws IOException if any. * @throws java.lang.Exception if any. */ @Override public Number ping(final InetAddress host, final long timeout, final int retries, final int packetsize) throws Exception { final SinglePingResponseCallback cb = new SinglePingResponseCallback(host); ping(host, timeout, retries, packetsize, (short)1, cb); cb.waitFor(); cb.rethrowError(); return cb.getResponseTime(); }