How to get client IP address in Applet
Written on January 5, 2010 at 3:05 pm by
mkyong
You can use the following example to get the client IP address in Applet. The process is not so straightforward, you have to get the current host and port from where Applet is loaded, and convert it to Socket object.
Socket socket = new Socket(getDocumentBase().getHost(), port); ip = socket.getLocalAddress().getHostAddress();
Example to get IP address in Applet
package com.mkyong.applet; import java.applet.*; import java.awt.Graphics; import java.io.IOException; import java.net.Socket; public class AppletExample extends Applet { String ip; public void init() { try{ int port; if(getDocumentBase().getPort()!=-1){ port = getDocumentBase().getPort(); }else{ port = 80; } Socket socket = new Socket(getDocumentBase().getHost(), port); ip = socket.getLocalAddress().getHostAddress(); }catch(IOException io){ System.out.println(io.getMessage()); } } public void paint( Graphics g ) { StringBuffer sb = new StringBuffer() .append(" IP address : ").append(ip); g.drawString(sb.toString(), 0,100); } }
Oracle Magazine (Free)
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world\'s largest enterprise software company.
Publisher : Oracle Corporation



China and Russia put the blame on some screwed up experiments of US for the earthquake that happened in Haiti.
Chinese and Russian Military scientists, these reports say, are concurring with Canadian researcher, and former Asia-Pacific Bureau Chief of Forbes Magazine, Benjamin Fulford, who in a very disturbing video released from his Japanese offices to the American public, details how the United States attacked China by the firing of a 90 Million Volt Shockwave from the Americans High Frequency Active Auroral Research Program (HAARP) facilities in Alaska
If we can recollect a previous news when US blamed Russia for the earthquake in Georgio. What do you guys think? Is it really possible to create an earthquake by humans?
I came across this article about Haiti Earthquake in some blog it seems very interesting, but conspiracy theories have always been there.