Aquí les dejo un pequeño código que me ha sido de utilidad.
public static void main(String[] args) {
try {
InetAddress address = InetAddress.getByName(new URL("http://192.168.222.7/web.html").getHost());
String ip = address.getHostAddress();
System.out.println(ip);
} catch (MalformedURLException | UnknownHostException ex) {
Logger.getLogger(JavaApplication3.class.getName()).log(Level.SEVERE, null, ex);
}
}
0 comentarios:
Publicar un comentario