The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
September 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

IP Address

Posted by Vijay Padmanabhan on September 05, 2000 at 5:25 PM

> I am writing a Bean, to be integrated into an installation s/w
> that will need to determine the IP address of the Machine/ System
> on which this software will be run. What is the best way to determine
> IP address.


Hi,

Actually you can make use of the java.net package for this.
The code snipplet will be like this.

...
InetAddress ia = InetAddress.getLocalHost();
String ipAddress = ia.getHostAddress();

This returns a String which has an dotted IP Address representation.



Replies:
  • Ip Abdul April 29, 2001 at 9:26 PM (0)

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us