public String PingIP(String add)
{
Runtime runtime = Runtime.getRuntime();
Process process = null;
String line = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader br = null;
String ip = add;
boolean res = false;
try
{
process = runtime.exec("ping " + ip);
is = process.getInputStream();
isr = new InputStreamReader(is);
br = new BufferedReader(isr);
while ((line = br.readLine()) != null)
{
if (line.contains("TTL"))
{
res = true;
break;
}
}
is.close();
isr.close();
br.close();
}
catch (IOException e)
{
System.out.println(e);
runtime.exit(1);
}
if (res)
{
return "success";
} else
{
return "fail";
}
}