62,569
社区成员




Runtime runtime = Runtime.getRuntime();
Process process =null;
String line=null;
InputStream is =null;
InputStreamReader isr=null;
BufferedReader br =null;
String ip="www.sna.com.cn"; //待Ping的地址
try
{
process =runtime.exec("ping "+ip);
is = process.getInputStream();
isr=new InputStreamReader(is);
br =new BufferedReader(isr);
while( (line = br.readLine()) != null )
{
System.out.println(line);
System.out.flush();
}
is.close();
isr.close();
br.close();
}
catch(IOException e )
{
System.out.println(e);
runtime.exit(1);
}
public boolean isReachable(int timeout) throws IOException