We have an app which uses an IPv4-style UDP broadcast to "ping" the local network, so it can find the IP address of a specific custom embedded hardware device which responds to that broadcast. This all worked fine until iOS 9. Now, the sendto() call in our app fails with errno == EADDRESSUNAVAIL. Digging further, we believe that our UDP broadcast to 255.255.255.255 is just incompatible with the new iOS9, IPv6 way of doing things.
Everything I read tells me that IPv6 multicast is the "right" way to solve that problem, now. We've tried to modify our code to send our "is anybody out there?" UDP broadcast via IPv6 multicast, but that doesn't quite work yet. Before I go into details, though, my first question is: is this problem even fundamentally solvable? We cannot update the firmware on the embedded device our app is searching for; that device has an IPv4 stack, it listens for UDP broadcasts on 255.255.255.255 and we cannot change its code to do anything else. Given this limitation, is there any way at all an app running on iOS9 (with its IPv6-only stack) can even send a UDP packet that our device will hear? In other words, are we fundamenally screwed?
If this problem is even tractable at all, here is my stack overflow post - including code - that describes my attempt to solve it in IPv6.
My one response from Stack Overflow suggests that I used a different IPv6 address. I tried that, but "no joy."
Really, I think we are going to need guidance from someone intimiately familiar with Apple's iOS 9 implementation of POSIX networking. I don't think we are going to get there by guessing.
Finally - if there truly is no way to send an IPv4-style UDP broadcast from an iOS 9 app to our vintage 2005 embedded device ... how should we solve this problem in the future? If we build a new embedded device, what is the "right" way to do network discovery protocol? Bonjour? Something else? If we have to start over from scratch, I'd at least like to make sure we start off on the right foot.
Thanks to all.