Solved

Getting web server id from applet

Posted on 1998-11-17
5
153 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

627 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