Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Cameron Evans   on May 22 In Java Category.

  
Question Answered By: Dominic Murphy   on May 22

public static  String IP()
{
String ip = "";
try
{
String hostName = InetAddress.getLocalHost().getHostName();
InetAddress[] ipList = InetAddress.getAllByName(hostName);
for(int i = 0;i < ipList.length;i++)
{
ip = ipList[i].getHostAddress();
}
}
catch(Exception e)
{
//T.Mess(null,e.getMessage());
}
return ip;
}

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on How to get IP address? Or get search suggestion and latest updates.


Tagged: