I know that this question has been approached under different ways, but I have checked stackoverflow and I didn't found the answer I was looking for.
To make it simple : Is there a way to get the Time ping value to an IP server under Windows ?
I know how to check if some servers are reachable, but I would like to have precise values, like we can read on terminal.
Thank you for your help and understanding.
}
Output: Enter the host to be pinged : 8.8.8.8 Enter the no. of packets to be sent : 5 31.406 ms
Process finished with exit code 0
You can do something like this :
reference
UPDATE: As per your need
Written in little haste.
You can invoke the ping command and read the output (as explained in the previous answer), or if you need a lower lever access (like you can do with RAW sockets), you can have a look at the jpcap java library.
As shown here, you'll want to make use of the
Runtime
class to shell out a ping. All that's required of you is to parse the input stream (possibly using regex to get the time ping value).