Article View: cn.bbs.comp.lang.java
Article #24353How come I can't find the IP address of my local machine?
From: Flynn Family
Date: Tue, 24 Mar 1998 00:00
Date: Tue, 24 Mar 1998 00:00
30 lines
1077 bytes
1077 bytes
Even when I am connected to net I get an exception when using the following
code.
Is it because of a security feature.
import java.net.*;
class GetIPNumber
{
public static void main (String[] args)
{
InetAddress ia = null;
try
{
ia = InetAddress.getLocalHost ();
}
catch (Exception e)
{
System.out.println ("Error fetching local host name: " + e);
}
System.out.println ("Host Name/Address = " + ia);
}
}
Do I have to be connected to the Net to find my IP address?
John
Technical Details
Message-ID:
<6f911q$l99$1@news1.news.iol.ie>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f6cb0,2d88c4bf84216241,start X-Google-Attributes: gidf6cb0,public From: "Flynn Family" <kflynn@iol.ie> Subject: How come I can't find the IP address of my local machine? Date: 1998/03/24 Message-ID: <6f911q$l99$1@news1.news.iol.ie> X-Deja-AN: 337263528 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Ireland On-Line Newsgroups: cn.bbs.comp.lang.java