previous Periodwe encountered a very crash problem, the game at some point in the WiFi can not log in, switch to 4G. The error code is curle_couldnt_resolve_host, and the code is checked, which occurs when the resource update server is connected. On the computer with Nslookup check the domain name of the resource server, sure enough also appeared the error, notify the operation of the classmate, they checked for half a day, confirm the configuration of Cdn no problem, is Fujian Telecom's DNS server error. Hurriedly contact the students of telecommunications, and checked for a half-day, replied that the DNS server cache too much caused, restart after the OK. This matter is solved, but always feel not at ease, who knows the DNS server which day and not. Sure enough, this problem has come up again recently. In fact, based on the well-known reasons, I never use the internet when the operator assigned to the DNS, are directly set to Google dns,8.8.8.8, but you can not change the player's mobile phone DNS bar. There seems to be no good way out. But we are not easy to give up ~, in fact, there is another way, is curl backCurle_couldnt_resolve_host This error, indicating that the system provided by the DNS has not been used, then you use the socket to connect Google DNS to do domain name resolution! Search on the Internet some source code, toss a few days, finally transplant success! This way, every time a DNS error occurs when accessing the link with Curl, the domain name in the URL is resolved with Google DNS, and then the domain name is replaced with IP re-access, for example, a URL is http://www.xyz.com/file-path.xml, using HTTP ://a.b.c.d/file-path.xml to visit. However, after testing, and found a new problem, access to the Http://www.xyz.com/check-update.php?param ... This PHP link is not the same time. The person who has done the service will know that if the server is configured with a virtual host, it must be accessed with a domain name, with direct IP access is not a drop. Then you have to skip curl completely, connect the socket to the resolved IP, build the TCP link, send an HTTP request, parse the HTTP return HTTP protocol ... Fortunately found a good open source implementation Http-parser (Https://github.com/joyent/http-parser), but also a transplant, debugging, testing .... It's finally done. I think this should be a common problem, do not know whether classmates have encountered similar problems, there is no better solution?
What about DNS instability?