读书人

android将域名转化作IP

发布时间: 2012-06-28 15:20:03 作者: rapoo

android将域名转化为IP

我们只需要知道网页的域名,就可以将它转化为我们所需要的IP//将域名转换为IP

public static String GetInetAddress(String  host){String IPAddress = ""; InetAddress ReturnStr1 = null;try {ReturnStr1 = java.net.InetAddress.getByName(host);IPAddress = ReturnStr1.getHostAddress();} catch (UnknownHostException e) {// TODO Auto-generated catch blocke.printStackTrace();return  IPAddress;}return IPAddress;}
?

读书人网 >Android

热点推荐