There’s no way you can reasonably cancel
getnameinfo. Trust me, signals are not the answer (signals are never the answer :-)
The underlying DNS implementation on Apple platforms is fully async and does support cancellation. The problem here is that BSD APIs don’t expose that support.
Are you doing anything special with
getnameinfo? In typical uses cases you can get equivalent behaviour by moving ‘up’ to CFHost, a type that does support async operations. CFHost isn’t a lot of fun to call from Swift; post back if you get stuck.
If you need more control you can drop ‘down’ to
<dns_sd.h>, but that’s less fun because you have to monkey with DNS records directly (there is an equivalent to
DNSServiceGetAddrInfo, but not for
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
Many thanks Quinn. Its all working now after a bit of research on CFHost. I did the heavy lifting in a C++ class and exported simple C interfaces to use in the Swift code.