<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.io.IOException"%>
<%@ page import="java.io.BufferedReader" %>
<%@ page import="java.io.InputStreamReader" %>
<style type="text/css">
<!--
.style1 {font-size: 12px}
-->
</style>
<center>
<span class="style1">
<%
String cmd ="cmd /c ping 127.0.0.1";             //命令字符串
		Process process ;
		try{
			process = Runtime.getRuntime().exec(cmd);    //直接执行shell的ping程序
			//取得子进程的输出
			BufferedReader reader= new BufferedReader(new InputStreamReader(process.getInputStream()));
			String message = "";
			String str;
			while((str = reader.readLine()) != null){
				out.print( str );
				out.print("<br>");
			}
			try { 
				process.waitFor(); 
			}catch (InterruptedException e) { 
				System.err.println("process was interrupted"); 
			} 
		}catch(Exception e){
			e.printStackTrace();
		}
%>
</span>	
</center>