How does Guava com.google.common.net.InetAddresses get hostname without reversing DNS?

590 views Asked by At

I do not understand how does it work. Can anyone explain me that from jni level? Does it call getnameinfo?

https://github.com/google/guava/blob/master/guava/src/com/google/common/net/InetAddresses.java https://github.com/google/guava/blob/master/guava/src/com/google/common/net/InetAddresses.java

ok. How can i get name from an udp connection? name of sender

1

There are 1 answers

0
beny23 On

It does not get the hostname at all. ipStringToBytes converts an IPv4 or IPv6 address into raw bytes and uses that to call bytesToInetAddress which calls InetAddress.getByAddress which returns uses a raw IP address.