I use this code to get my current IP:
public String getIpAddress() throws NullPointerException,
MalformedURLException, IOException {
URL whatismyip = new URL("http://checkip.amazonaws.com");
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(
whatismyip.openStream()));
String ip = in.readLine();
return ip;
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
but the return value is incorrect. how to get the IP properly