Get scope id/network interface of NsdServiceInfo of a link-local IPv6 service

437 Views Asked by At

I want to connect to a link-local IPv6 service represented by an NsdServiceInfo. The service is announced in the LAN via zeroconf. Therefore I need the scope ID in addition to the IP (i.e. to create "<IPv6>%<scope ID>"). However, I could not find a way to retrieve the scope ID (i.e. the network interface through which the service was discovered) out of the NsdServiceInfo. For now, as an ugly workaround, I iterate over all network interfaces and check reachability of the server IP using NsdServiceInfo#getHost()#isReachable().

BTW NsdServiceInfo#getHost()#getScopeId() and NsdServiceInfo#getHost()#getScopedInterface() do always return 0 and null respectively.

Am I missing something here or is there actually no straight forward solution to this?

0

There are 0 best solutions below