Some embodiments of this application provide a
network connection method, apparatus, and communication module. During each
network connection attempt, a candidate DNS
server is selected from a DNS
server list, a DNS request is sent to it, a corresponding DNS response is received, and a communication negotiation process is initiated based on the candidate
IP address in the DNS response. If the negotiation fails, another candidate DNS
server is selected from the DNS server
list, and the above process of sending DNS requests is repeated. That is, by uniformly controlling the
domain name resolution process and the communication negotiation process in the
network connection process, it is ensured that
domain name resolution is performed sequentially through different DNS servers within the same network connection process. Even if a DNS server successfully returns a DNS response, no further DNS requests are sent to it because the communication negotiation for the
IP address in that response has failed. This avoids repeated execution of the same failure
scenario within the same network connection process, reduces unnecessary time waste, and improves network connection speed.