Getting DNS Server Address (SRV Records)

I have a need to get the local DNS server address in iOS. I need this because I need to query for SRV records for a game. I can not find any calls that allows me to query SRV records so I must craft the DNS request and send it. Since I cant find a way to do this, I have to query Google DNS which has its own set of problems, most of which deal with it being blocked by ISP's or countries as a whole. How can I either get the local DNS server address or query for SRV records? Thank you for your help!

Ray

Apple has sample code for the Mac that does this. According to the instructions, it should also work with iOS.


https://developer.apple.com/library/mac/samplecode/SRVResolver/Introduction/Intro.html

In case others run into this, let me add this warning about the SRVResolver code:

In the function QueryRecordCallback, the code first makes some assertions before checking the errorCode. That's likely to cause problems because if you get an error (such as if a user doesn't give your app permission to use the network calls), the asserts may get triggered. To fix this, move the assert calls inside the code that checks for error == 0.

Getting DNS Server Address (SRV Records)
 
 
Q