【问题标题】:How to get ip adress of the domain using url in android? [duplicate]如何在android中使用url获取域的IP地址? [复制]
【发布时间】:2014-09-09 12:18:09
【问题描述】:

我想从android中的url获取ip地址,怎么可能?

【问题讨论】:

    标签: android eclipse dns ip


    【解决方案1】:

    这样做

    InetAddress address = InetAddress.getByName("www.google.com"); 
    String ip = address.getHostAddress(); 
    

    并确保您拥有互联网许可。

    【讨论】:

    • 我试过了,codes.first 行正常,但第二行不工作。
    • 不工作是什么意思?你有错误吗?
    • 是的,它会抛出异常。
    • 尝试 { InetAddress 地址 = InetAddress.getByName("www.google.com");字符串 ip = address.getHostAddress(); } 捕捉(异常 e){ }
    • 你能发个例子吗? facebook上的harunkaraca19@yandex.com.tr
    猜你喜欢
    • 2023-03-05
    • 1970-01-01
    • 1970-01-01
    • 2023-04-08
    • 2011-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-23
    相关资源
    最近更新 更多