mausam
Posts: 243
Nickname: mausam
Registered: Sep, 2003
|
|
Re: Java Applet
|
Posted: Sep 15, 2003 6:24 AM
|
|
import java.net.*;
import java.io.*;
import java.applet.*;
public class GetClientIP extends Applet {
public void init() {
try {
InetAddress thisIp =
InetAddress.getLocalHost();
System.out.println("IP:"+thisIp.getHostAddress());
}
catch(Exception e) {
e.printStackTrace();
}
}
}
but i m not sure if it will give correct IP as i have not tested it
the logic behind not giving correct ip is that Since applets run on the client, the IP is always 127.0.0.1 (localhost).
|
|