7

Do the c-ares support IOS? I need to use c-ares in my company's app running on IOS. But It can't work correctly using "ares_gethostbyname()" and the status code in the callback function returns 11(ARES_ECONNREFUSED) all the time . The same code runs correctly on other opearting system such as Win32, Android.

Glancing over the source code, I found the reason, that is, c-ares is unable to get dns servers on IOS. Because c-ares read the file /etc/resolv.conf to get dns servers information, but this file does not exist on IOS.

So, do the c-ares support IOS? Or What's the method on IOS to get dns servers information?

Daniel Stenberg
  • 54,736
  • 17
  • 146
  • 222

1 Answers1

3

I found a patch for this that never was merged into the master repo, posted in December 2014.

It'd be great if you could try it out and report back on the c-ares mailing list so that we can work on getting it merged and supported "officially".

/ awful c-ares maintainer :-(

Daniel Stenberg
  • 54,736
  • 17
  • 146
  • 222
  • Thx! I also tried to get dns servers information by calling "res_ninit()". But I find a strange problem. I can get dns server ip correctly when connecting Internet, but it does not work if disconnecting Internet. So I want to know why "res_ninit()" need to connect to the network to get dns servers information? – wanghongyun May 13 '15 at 10:36
  • If "res_ninit()" need to connect to the network, it will be uncontrollable. Maybe, it will take much time to get dns information. So I think that if Merging this code into "ares_init", it is unacceptable to spend long time to initialize. – wanghongyun May 14 '15 at 02:09
  • You're mixing subjects. res_init or res_ninit have nothing at all to do with c-ares or how it works. – Daniel Stenberg May 14 '15 at 14:35