InetAddress.getLocalHost() throws UnknownHostException

Put your problem here if it does not fit any of the other categories.

InetAddress.getLocalHost() throws UnknownHostException

Postby automatonx » Mon Jan 07, 2008 8:50 am

I tried to use InetAddress.getLocalHost() to obtain local host ip. But it is throwing UnknownHostException. Is there anyway to get the IP address for the device /emulator programatically.
automatonx
Freshman
Freshman
 
Posts: 3
Joined: Sat Dec 29, 2007 12:41 am

Top

Postby plusminus » Mon Jan 07, 2008 4:18 pm

Hello automatonx

The internal IP of the Emulator is 127.0.0.1 .

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby automatonx » Tue Jan 08, 2008 1:17 am

Hi plusminus,

Thanks for the reply. I understand there could be loop back IP but I wanted to get the Non-loop back IP programatically from Java code.

I tried several ways, but no luck so far.
automatonx
Freshman
Freshman
 
Posts: 3
Joined: Sat Dec 29, 2007 12:41 am

Postby plusminus » Fri Jan 11, 2008 9:29 pm

Hello automatonx,

does this help :?::

Class: java.net.NetworkInterface
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  public Enumeration  getInetAddresses()
  2. Answers the list of internet addresses bound to the interface
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 16 guests