Solved

Retrieving a user's host and domain...

Posted on 1998-02-13
1
181 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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
scoreUp challenge 14 47
Increment alphanumeric sequence 6 78
sumDigits  challenge 7 59
Image decoding from Camera 3 41
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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 will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
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…

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

11 Experts available now in Live!

Get 1:1 Help Now