Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Getting web server id from applet

Posted on 1998-11-17
5
Medium Priority
?
155 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 200 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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This video teaches viewers about errors in exception handling.
Suggested Courses

722 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