Solved

Getting web server id from applet

Posted on 1998-11-17
5
152 Views
Last Modified: 2010-03-30
How can an applet get the name and/or the IP address
of the Web server machine.
Please do not suggest, passing them as parameters, I want
to use one HTML file in many installations.
0
Comment
Question by:mco
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 

Expert Comment

by:hemadri
ID: 1227625
Try using InetAddress class's getLocalHost() method and use getHostName() method.
0
 
LVL 1

Author Comment

by:mco
ID: 1227626
No, that gives me the name of the local machine (where the browser is running).
I need the machine where the Web server, from which the applet was loaded, runs.

0
 
LVL 1

Author Comment

by:mco
ID: 1227627
No, that gives me the name of the local machine (where the browser is running).
I need the machine where the Web server, from which the applet was loaded, runs.

0
 
LVL 16

Accepted Solution

by:
heyhey_ earned 50 total points
ID: 1227628
(working from memory )
this should work

this.getCodebase().getHost();

(where this is the Applet)
or i'm wrong ?

P.S. Are you sure that getLocalHost WILL return the local machine address (for unsigned applet). What about security restrictions ??


0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1227629
and then InetAddress.getByName to find the IP address

public static InetAddress getByName(String host) throws UnknownHostException

hope this helps
  heyhey

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question