Need to perform a reverse DNS lookup of a particular IP address in java

后端 未结 3 1607
生来不讨喜
生来不讨喜 2020-12-09 20:31

I need to get the DNS address, for example \"http://stackoverflow.com/questions/ask\". I used the following code and able to get in the form of 192.X.X.X.

3条回答
  •  一整个雨季
    2020-12-09 21:12

    InetAddress ia = InetAddress.getByAddress(new byte[] {74,125,127,106});
    // or 
    ia = InetAddress.getByName("74.125.127.106");
    System.out.println(ia.getCanonicalHostName());
    

提交回复
热议问题