cqwrteur
cqwrteur

Reputation: 99

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

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

Upvotes: 0

Views: 642

Answers (1)

beny23
beny23

Reputation: 35068

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.

Upvotes: 0

Related Questions