Search code examples
javahtmlappletip-addresslighttpd

How do I get the address used to access a website in java


I'm sorry about the terible wording of my question but I wasn't sure how else to word it.

Anyway, I have a Java Applet that is embbeded on a webpage. That webpage is then put up in the network using the webserver lighttpd. I need to from within the Java applet (through webpage accessed from different computer on the network) get the IPv4 Address of the computer which is running the server (this is the address typed in to access page, ex. "http://192.168.1.123"). I have tried everything I have found or could think of but nothing has worked so far. PLEASE help if you can.

specs:

-Eclipse Helios
-Windows 7
-lightTPD for windows
-webpage is html document

email or comment if you need more info!

thank you all in advance.


Solution

  • How about generating the page with the java applet with php? You could then pass the IP of the server as a parameter to the applet.

    http://docs.oracle.com/javase/tutorial/deployment/applet/param.html