How to Ping an Ip Address Using Java (Simple)

preview_player
Показать описание
How to Ping an Ip Address Using Java (Simple)

Greetings, today in this Java tutorial we shall be looking at how to ping an ip address or a url to see if it is reachable. This tutorial won't tell you how long it took, but will allow us to set a maximim amount of time to try reaching an address in.

We can ping an ip address in Java with the InetAddress class. This class represents an Internet Protocol (IP) address. We can use the isReachable() function with a timeout time. This function tests wether a specified address is reachable.

Is this the best way? No, we could also use a process builder or use sockets. However those will be covered in future tutorials. isReachable() is a good starting point.

Thanks for watching this tutorial on how to ping an ip address using Java to check if an address is reachable.

How to Ping an Ip Address Using Java (Simple)
Рекомендации по теме