I'm trying to create a web application which can display the results of a ping command real-time. I'm using JSP in the backend. I'm actually getting the result correctly. But the problem is, the result is not displayed in real-time. The application processes the ping command and dumps the result all at once. What I need is that, the application has to display the result line after line as and when a line of result is obtained.
Here is my code
String ip = request.getParameter("ipaddress");
String pingCmd = "ping -c 3 " + ip;
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec(pingCmd);
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
{
out.println(inputLine + "<br />");
}
in.close();
What is the change I need to make in this code.
Regards
Sunil Kumar B M