Ver Mensaje Individual
  #2 (permalink)  
Antiguo 22/11/2006, 05:07
Avatar de Valkam
Valkam
 
Fecha de Ingreso: junio-2006
Ubicación: Sevilla
Mensajes: 157
Antigüedad: 17 años, 10 meses
Puntos: 0
Yo lo hacia as, a ver si te vale:

Código:
public String clientIP()
	{
		
	String s1 = "unknown";
        String s2 = getDocumentBase().getHost();
        int i = 80;
        if(getDocumentBase().getPort() != -1)
            i = getDocumentBase().getPort();
        try
        {
            String s = (new Socket(s2, i)).getLocalAddress().getHostAddress();
            if(!s.equals("255.255.255.255"))
                s1 = s;
        }
        catch(SecurityException _ex)
        {
            s1 = "ERROR";
        }
        catch(Exception _ex)
        {
            s1 = "ERROR";
        }
        
        return s1;
	}

Como ves no es tan trivial como pillar la IP a través del applet ya que está te devolverá normalmente Localhost. Por eso abro un socket.

Saludos