Un boucle de ping

isgt Messages postés 43 Date d'inscription samedi 29 mars 2008 Statut Membre Dernière intervention 15 mai 2012 - 20 déc. 2010 à 20:19
isgt Messages postés 43 Date d'inscription samedi 29 mars 2008 Statut Membre Dernière intervention 15 mai 2012 - 21 déc. 2010 à 21:35
Bonsoir à tous
ma question est la suivante commet je peut faire un boucle de ping pour scanner mon réseau
voila la code qui me permet de pinger sur une seule machine et moi je veux récupérer tous les adresse de la plage exep "192.168.1.1" jusqu’à 192.168.1.50"
*************** *
public static void main(String[] args) {


String ip = "127.0.0.1";


String pingResult = "";

String pingCmd = "ping " + ip;
try {
Runtime r = Runtime.getRuntime();
Process p = r.exec(pingCmd);

BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {

String x = inputLine+"\n";
//text_P_Result.append(x);
pingResult += inputLine+"\n";
System.out.println(pingResult);


}
in.close();

}//try
catch (IOException e) {System.out.println(e);}

}

1 réponse

isgt Messages postés 43 Date d'inscription samedi 29 mars 2008 Statut Membre Dernière intervention 15 mai 2012
21 déc. 2010 à 21:35
aucune réponse
0
Rejoignez-nous