Ping en java

Bonjours, je sais qu’il est possible de faire des pings avec java5, mais je n’arrive pas a trouver la commande et la syntaxe correcte pour que ca fonctionne, quelqu’un peut m’aider?
Merci

Elvis
:bounce:

google =>
import java.io.;
import java.net.
;

public class PseudoPing {
public static void main(String args[]) {
try {
Socket t = new Socket(args[0], 7);
DataInputStream dis = new DataInputStream(t.getInputStream());
PrintStream ps = new PrintStream(t.getOutputStream());
ps.println(“Hello”);
String str = is.readLine();
if (str.equals(“Hello”))
System.out.println(“Alive!”) ;
else
System.out.println(“Dead or echo port not responding”);
t.close();
}
catch (IOException e) {
e.printStackTrace();}
}
}

Merci beaucoup