Ver Mensaje Individual
  #8 (permalink)  
Antiguo 23/04/2013, 11:19
Avatar de Fuzzylog
Fuzzylog
 
Fecha de Ingreso: agosto-2008
Ubicación: En internet
Mensajes: 2.511
Antigüedad: 15 años, 8 meses
Puntos: 188
Respuesta: Obtener la IP en java

Prueba esto (sacado de): http://stackoverflow.com/questions/4...me-is-64-chars

try {
// Replace eth0 with your interface name
NetworkInterface i = NetworkInterface.getByName("eth0");

if (i != null) {

Enumeration<InetAddress> iplist = i.getInetAddresses();

InetAddress addr = null;

while (iplist.hasMoreElements()) {
InetAddress ad = iplist.nextElement();
byte bs[] = ad.getAddress();
if (bs.length == 4 && bs[0] != 127) {
addr = ad;
// You could also display the host name here, to
// see the whole list, and remove the break.
break;
}
}

if (addr != null) {
System.out.println( addr.getCanonicalHostName() );
}
} catch (...) { ... }
__________________
if (fuzzy && smooth) {
fuzzylog = "c00l";
return true;
}