Solved

Getting web server id from applet

Posted on 1998-11-17
5
148 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
  • 2
  • 2
5 Comments
 

Expert Comment

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

Author Comment

by:mco
Comment Utility
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
Comment Utility
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
Comment Utility
(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_
Comment Utility
and then InetAddress.getByName to find the IP address

public static InetAddress getByName(String host) throws UnknownHostException

hope this helps
  heyhey

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
word0 challenge 3 55
firstChar challenge 13 81
compre toata in where clue oracle 4 39
Java - Why doesn't this JFrame work 3 13
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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…
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:
The viewer will learn how to implement Singleton Design Pattern in Java.

728 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now