Tuesday 2 May 2023

How to use a IPv6 link-local address with Retrofit as baseUrl

I'm using the NsdManager to resolve a service on the local network (iot device). The resolveService returns me a NsdServiceInfo with a host and a port. The host is a Inet6Address object with a link-local address (fe80::xxxx:xxxx:xxxx:9718) and no scope set. It also returns me a true for isLinkLocalAddress. How can I use this link-local address without a scope to make any network call?

The only way I can ping the service with my local machine is by also specifying a network interface e.g. like this: ping6 fe80::xxxx:xxxx:xxxx:9718%en0.

It feels like I'm missing some vital aspect of the Android API or the IPv6 spec here. Personally, I'd rather just get a IPv4 address but there doesn't seem to be a way to tell the NsdManager that either.



from How to use a IPv6 link-local address with Retrofit as baseUrl

No comments:

Post a Comment