Solved

Retrieving a user's host and domain...

Posted on 1998-02-13
1
183 Views
Last Modified: 2010-04-16
I was wondering if and how I can retrieve a user's host and domain.  Is this possible through Java and if so how?
0
Comment
Question by:bjg
1 Comment
 
LVL 6

Accepted Solution

by:
jpk041897 earned 50 total points
ID: 1233041
Class java.net.InetAddress will give you the tools you need to obtain the host name, specificaly:

getHostName public String getHostName()
 
 Gets the hostname for this address; also the key in the hashtable. If the host is equal to null, then this address refers to any of the local machine's available network addresses.  

For the domain name, best approach would be to use Java.net.Socket.getInetAddress()returns an InetAddress from which you can retrieve the IP adress (for a call to an NSLookup Server) or you can use the Socket's toString() method to obtain the Domain name, provided its available in the URL and not an IP number.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
web services creation SOAP vs REST 5 38
use lov values 2 49
Java exception bubble up 2 17
Android development question 2 34
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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:

785 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