I want to detect if the adapter is connected to the iPhone even if no IP has been given to the iPhone. I can detect that the interface is connected when the iPhone has been given an IP address, but how can I detect the adapter when not?
even if no IP has been given to the iPhone.
Given to the iPhone by what? A DHCP server?
If that’s what you’re concerned about then I think you’re missing a key point. DHCP is primarily relevant to IPv4 [1]. Assuming the link is up, the interface will have an IPv6 link-local address [1].
I recommend that you read through the posts referenced by Extra-ordinary Networking. They explain a lot of the backstory to this.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] Yeah, there’s DHCPv6, but it’s not the primary mechanism for IPv6 address assignment.
[2] It’s likely also get an IPv4 link-local address, per RFC 3927, but that’s not nearly as straightforward.