Is there a way to take an argument in a callable method?

You can’t pass it as the argument to call() because the method signature doesn’t allow it. However, you can pass the necessary information as a constructor argument; e.g. public class DoPing implements Callable<String>{ private final String ipToPing; public DoPing(String ipToPing) { this.ipToPing = ipToPing; } public String call() throws SomeException { InetAddress ipAddress = InetAddress.getByName(ipToPing); … Read more

Fastest way to ping a network range and return responsive hosts?

You should use nmap: nmap -T5 -sn 192.168.0.0-255 nmap -T insane -sn 192.168.0.0-255 # same as above but w/named template The -T 5/insane option uses the “insane” template, which: insane mode assumes that you are on an extraordinarily fast network or are willing to sacrifice some accuracy for speed. -T4 (aggressive) prohibits the dynamic scan … Read more

Send a ping to each IP on a subnet

Not all machines have nmap available, but it’s a wonderful tool for any network discovery, and certainly better than iterating through independent ping commands. $ nmap -n -sP 10.0.0.0/24 Starting Nmap 4.20 ( http://insecure.org ) at 2009-02-02 07:41 CST Host 10.0.0.1 appears to be up. Host 10.0.0.10 appears to be up. Host 10.0.0.104 appears to … Read more

How to ping an IP address

InetAddress.isReachable() according to javadoc: “.. A typical implementation will use ICMP ECHO REQUESTs if the privilege can be obtained, otherwise it will try to establish a TCP connection on port 7 (Echo) of the destination host..”. Option #1 (ICMP) usually requires administrative (root) rights.

How to ping ubuntu guest on VirtualBox [closed]

In most cases simply switching the virtual machine network adapter to bridged mode is enough to make the guest machine accessible from outside. Sometimes it’s possible for the guest machine to not automatically receive an IP which matches the host’s IP range after switching to bridged mode (even after rebooting the guest machine). This is … Read more