This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Servlets and the fly likes How to get the server IP, hostname and MAC? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "How to get the server IP, hostname and MAC?" Watch "How to get the server IP, hostname and MAC?" New topic
Author

How to get the server IP, hostname and MAC?

Lester Tam
Ranch Hand

Joined: Jun 19, 2003
Posts: 31
As title thanks.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
see API docs.


42
Lester Tam
Ranch Hand

Joined: Jun 19, 2003
Posts: 31
Hello,

i find that i can use this way to get the ip and host name:

hostInfo = InetAddress.getLocalHost();
ip = hostInfo.getHostAddress();
hostName = hostInfo.getHostName();

but still dont know how to get the MAC address.

Any help?
Lester
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
you can't get the MAC address. It's not exposed as you have no business using it.
The network is only concerned with ip addresses except at the hardware level which is deeper in the network architecture than what Java is designed to handle.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get the server IP, hostname and MAC?