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 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

ping: google.com: Temporary failure in name resolution [closed]

I’ve faced the exactly same problem but I’ve fixed it with another approache. Using Ubuntu 18.04, first disable systemd-resolved service. sudo systemctl disable systemd-resolved.service Stop the service sudo systemctl stop systemd-resolved.service Then, remove the link to /run/systemd/resolve/stub-resolv.conf in /etc/resolv.conf sudo rm /etc/resolv.conf Add a manually created resolv.conf in /etc/ sudo vim /etc/resolv.conf Add your prefered … 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.

Ping a site in Python?

See this pure Python ping by Matthew Dixon Cowles and Jens Diemer. Also, remember that Python requires root to spawn ICMP (i.e. ping) sockets in linux. import ping, socket try: ping.verbose_ping(‘www.google.com’, count=3) delay = ping.Ping(‘www.wikipedia.org’, timeout=2000).do() except socket.error, e: print “Ping Error:”, e The source code itself is easy to read, see the implementations of … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)