|
|
| i need help |
Expert:subhash chandra
hello, i need help regarding this program.
public class PingTest {
public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter IP Address : " );
try { String ip = br.readLine(); Process p = Runtime.getRuntime().exec("ping " + ip); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String result; BufferedWriter bw = new BufferedWriter(new FileWriter("out.txt"));
while ((result = in.readLine()) != null) { bw.write(result + "\n"); } in.close(); bw.close();
} catch (IOException ioe) { System.err.println("IOEXception occured : " + ioe.getMessage()); } } }
it is printing the result of ping in to a file,but if i want to maintain two files in which one file will be for the reply arrived and the other file must store the result in which there is no reply from the server like "request timed out" and it must calculate the total time in the both files. please, guide me
and how my program can take ping for every 5Minutes and store the result in to the files,if i want to do this i must make my program running in the background. please guide me how i can run my program in the background.
|
| Answers |
| More Questions |
|
|
Post Answers
Ask Question
Facing Programming Problem?
|
|
|
|
|