Note that there are some explanatory texts on larger screens.

plurals
  1. POTest when server is up or down
    primarykey
    data
    text
    <p>I am trying to test for a server if its reachable or not. I am tailing log files from different servers using ssh and connecting to server using java Ganymed from the following web <a href="http://www.ganymed.ethz.ch/ssh2/" rel="nofollow">http://www.ganymed.ethz.ch/ssh2/</a>. So I am trying to find a simple way of pinging a server because I want to show the user a list of up and down servers so they know their status when they try to tail log files on the servers.</p> <p>Any shed of light would is highly appreciated. I also tried using JPingy but I am not sure if it does what I want as I am getting long messages an exception. Is there something I can use to test if some server is reachable so I can update user with its status ? The following is the code I use from JPingy example which shows me some odd messages which I don't understand. </p> <pre><code>public class Main { public static void main(String[] args) { PingArguments arguments = new PingArguments.Builder().url("google.com") .timeout(5000).bytes(32).build(); PingResult results = Ping.ping(arguments, Backend.UNIX); System.out.println(results.ttl()); System.out.println(results.rtt_min()); System.out.println(results.received()); } </code></pre> <p>}</p> <p>The exception that I am getting is the following</p> <pre><code> java.lang.ArrayIndexOutOfBoundsException: 1 at com.googlecode.jpingy.UnixPingResult.matchReceived(UnixPingResult.java:52) at com.googlecode.jpingy.PingResult.&lt;init&gt;(PingResult.java:79) at com.googlecode.jpingy.UnixPingResult.&lt;init&gt;(UnixPingResult.java:29) at com.googlecode.jpingy.Ping$Backend$1.getResult(Ping.java:31) at com.googlecode.jpingy.Ping.ping(Ping.java:59) at Main.main(Main.java:13) Exception in thread "main" java.lang.NullPointerException at Main.main(Main.java:15) </code></pre> <p>Any kind of help is really appreciated, is it possible to have a true or false returned for connection using some other library ?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload