CN105991797B - Method and device for mobile terminal to access network - Google Patents
Method and device for mobile terminal to access network Download PDFInfo
- Publication number
- CN105991797B CN105991797B CN201610513275.4A CN201610513275A CN105991797B CN 105991797 B CN105991797 B CN 105991797B CN 201610513275 A CN201610513275 A CN 201610513275A CN 105991797 B CN105991797 B CN 105991797B
- Authority
- CN
- China
- Prior art keywords
- preset
- access
- mobile terminal
- ips
- network
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/45—Network directories; Name-to-address mapping
- H04L61/4505—Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
- H04L61/4511—Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/50—Address allocation
- H04L61/5007—Internet protocol [IP] addresses
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mobile Radio Communication Systems (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本发明提供了一种移动终端访问网络的方法及装置,该方法包括:监控移动终端的网络访问事件;当监控到所述移动终端网络访问失败时,获取网络访问失败的IP以及该IP对应的访问域名;获取预先建立的域名与预设IP的第一对应关系,在所述第一对应关系中查找所述访问域名对应的预设IP,其中,所述预设IP与所述网络访问失败的IP不同;以及利用所述预设IP重新进行网络访问。本发明实施例的技术方案能够在移动终端网络访问失败时,获取访问域名对应的预设IP,并利用预设IP重新进行网络访问,从而解决了因域名解析错误或被劫持而导致的访问失败的问题。
The present invention provides a method and device for a mobile terminal to access a network. The method includes: monitoring network access events of the mobile terminal; when monitoring the network access failure of the mobile terminal, acquiring the IP of the network access failure and the corresponding IP address. Accessing a domain name; obtaining a first correspondence between a pre-established domain name and a preset IP, and searching for a preset IP corresponding to the visiting domain name in the first correspondence, wherein the preset IP and the network access fail The IP is different; and use the preset IP to perform network access again. The technical solutions of the embodiments of the present invention can obtain the preset IP corresponding to the access domain name when the mobile terminal fails to access the network, and use the preset IP to re-access the network, thereby solving the access failure caused by the domain name resolution error or hijacking The problem.
Description
技术领域technical field
本发明涉及互联网应用技术领域,特别是一种移动终端访问网络的方法及装置。The present invention relates to the technical field of Internet applications, in particular to a method and device for accessing a network by a mobile terminal.
背景技术Background technique
随着移动终端功能的增强,其已经成为人们生活中的必备品。为了满足用户的各种需求,互联网上存在基于智能移动终端开发的各种各样的应用,提供给用户越来越多的人性化的功能。With the enhancement of functions of mobile terminals, they have become a must-have in people's lives. In order to meet various needs of users, there are various applications developed based on intelligent mobile terminals on the Internet, providing users with more and more humanized functions.
在这些应用中,通常会进行各种网络的访问(如下载等),在访问之前,首先需要对域名进行解析,得到提供网络服务的服务器的IP,从而连接对应的IP以访问所需的内容。一般来说,某一业务的服务器会有多个,也就是有多个对应的IP,域名解析的过程会从这些IP中选择一个来作为解析的结果。在这种情况下,若域名解析错误或被劫持,将会导致访问失败的问题。因而,亟待解决这一问题。In these applications, various network accesses (such as downloading, etc.) are usually performed. Before accessing, the domain name needs to be resolved first to obtain the IP of the server providing network services, so as to connect the corresponding IP to access the desired content . Generally speaking, there are multiple servers for a certain service, that is, there are multiple corresponding IPs, and the domain name resolution process will select one of these IPs as the resolution result. In this case, if the domain name is incorrectly resolved or hijacked, access will fail. Therefore, it is urgent to solve this problem.
发明内容SUMMARY OF THE INVENTION
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的移动终端访问网络的方法及相应的装置。In view of the above problems, the present invention is proposed to provide a method and a corresponding apparatus for a mobile terminal to access a network that overcomes the above problems or at least partially solves the above problems.
依据本发明的一方面,提供了一种移动终端访问网络的方法,包括:According to an aspect of the present invention, a method for accessing a network by a mobile terminal is provided, including:
监控移动终端的网络访问事件;Monitor network access events of mobile terminals;
当监控到所述移动终端网络访问失败时,获取网络访问失败的IP以及该IP对应的访问域名;When monitoring the network access failure of the mobile terminal, obtain the IP of the network access failure and the access domain name corresponding to the IP;
获取预先建立的域名与预设IP的第一对应关系,在所述第一对应关系中查找所述访问域名对应的预设IP,其中,所述预设IP与所述网络访问失败的IP不同;以及Obtain a first correspondence between a pre-established domain name and a preset IP, and search for a preset IP corresponding to the access domain name in the first correspondence, where the preset IP is different from the IP of the network access failure ;as well as
利用所述预设IP重新进行网络访问。Use the preset IP to perform network access again.
可选地,通过以下步骤建立所述第一对应关系:Optionally, the first correspondence is established through the following steps:
获取提供网络访问服务的多个服务器各自的域名和IP;Obtain the respective domain names and IPs of multiple servers that provide network access services;
对所述多个服务器各自的域名进行聚类,将域名相同的作为一类;以及Clustering the respective domain names of the plurality of servers, and taking those with the same domain name as one category; and
根据聚类结果确定各个域名对应的一个或多个IP,以建立所述第一对应关系。One or more IPs corresponding to each domain name are determined according to the clustering result to establish the first correspondence.
可选地,所述获取提供网络访问服务的多个服务器各自的域名和IP的步骤进一步包括:Optionally, the step of obtaining the respective domain names and IPs of multiple servers providing network access services further includes:
接收云端服务器主动下发的提供网络访问服务的多个服务器各自的域名和IP;或者,Receive the respective domain names and IPs of multiple servers that provide network access services from the cloud server; or,
根据指定时间周期向云端服务器发送获取提供网络访问服务的多个服务器各自的域名和IP的请求,并接收所述云端服务器返回的包含所述多个服务器各自的域名和IP的响应信息。Send a request for obtaining the respective domain names and IPs of multiple servers providing network access services to the cloud server according to a specified time period, and receive response information returned by the cloud server including the respective domain names and IPs of the multiple servers.
可选地,若所述预设IP包括多个,所述利用所述预设IP重新进行网络访问的步骤进一步包括:Optionally, if the preset IP includes multiple, the step of using the preset IP to re-access the network further includes:
根据预设优选策略,从多个所述预设IP中选取一个优选IP;以及According to a preset preference policy, select a preferred IP from the plurality of preset IPs; and
利用选取的所述优选IP重新进行网络访问。Use the selected preferred IP to perform network access again.
可选地,所述根据预设优选策略,从多个所述预设IP中选取一个优选IP的步骤进一步包括:Optionally, the step of selecting a preferred IP from a plurality of the preset IPs according to the preset preferred strategy further includes:
确定所述移动终端当前所处的网络环境;determining the network environment where the mobile terminal is currently located;
获取所述移动终端的网络环境与预设IP的第二对应关系,并根据所述第二对应关系,从多个所述预设IP中选取与所述移动终端当前所处的网络环境对应的预设IP作为备选IP;Obtain a second correspondence between the network environment of the mobile terminal and a preset IP, and select a network environment corresponding to the current network environment of the mobile terminal from a plurality of the preset IPs according to the second correspondence The default IP is used as an alternative IP;
若所述备选IP为一个,则将所述备选IP作为所述优选IP;以及If the alternative IP is one, the alternative IP is used as the preferred IP; and
若所述备选IP为多个,则从多个所述备选IP中选取一个作为所述优选IP。If there are multiple alternative IPs, select one of the multiple alternative IPs as the preferred IP.
可选地,通过以下步骤建立所述第二对应关系:Optionally, the second correspondence is established through the following steps:
获取所述第一对应关系中包含的一个或多个预设IP;obtaining one or more preset IPs included in the first correspondence;
基于所述移动终端的网络环境,当所述移动终端处于所述网络环境时,测试所述移动终端对各个预设IP的访问路径是否连通;以及Based on the network environment of the mobile terminal, when the mobile terminal is in the network environment, test whether the access paths of the mobile terminal to each preset IP are connected; and
根据连通的访问路径对应的预设IP以及所述移动终端的网络环境,建立所述第二对应关系。The second correspondence is established according to the preset IP corresponding to the connected access path and the network environment of the mobile terminal.
可选地,所述根据连通的访问路径对应的预设IP以及所述移动终端的网络环境,建立所述第二对应关系的步骤进一步包括:Optionally, the step of establishing the second correspondence according to the preset IP corresponding to the connected access path and the network environment of the mobile terminal further includes:
确定连通的访问路径对应的预设IP各自对应的网络服务运营商;以及Determine the respective network service operators corresponding to the preset IPs corresponding to the connected access paths; and
从所述连通的访问路径对应的预设IP中,选取网络服务运营商与所述移动终端的网络环境一致的预设IP,并建立所述第二对应关系。From the preset IPs corresponding to the connected access paths, a preset IP that is consistent with the network service operator and the network environment of the mobile terminal is selected, and the second corresponding relationship is established.
可选地,所述从多个所述备选IP中选取一个作为所述优选IP的步骤进一步包括:Optionally, the step of selecting one from a plurality of the alternative IPs as the preferred IP further includes:
获取多个所述备选IP各自对应的访问速度;以及Acquiring the respective access speeds of the multiple alternative IPs; and
从多个所述备选IP中选取访问速度最快的IP作为所述优选IP。The IP with the fastest access speed is selected from the multiple candidate IPs as the preferred IP.
可选地,所述第二对应关系中还包括所述预设IP与访问速度的对应关系;Optionally, the second correspondence also includes the correspondence between the preset IP and the access speed;
所述获取多个所述备选IP各自对应的访问速度的步骤进一步包括:The step of obtaining the respective corresponding access speeds of the multiple alternative IPs further includes:
从所述第二对应关系中,查找作为备选IP的多个预设IP各自对应的访问速度。From the second correspondence, search for the access speed corresponding to each of the multiple preset IPs serving as candidate IPs.
可选地,通过以下步骤确定预设IP对应的访问速度:Optionally, determine the access speed corresponding to the preset IP through the following steps:
基于所述移动终端的网络环境,当所述移动终端处于所述网络环境时,从预设IP对应的服务器处下载指定大小的静态文件,并在下载的过程中获取访问速度。Based on the network environment of the mobile terminal, when the mobile terminal is in the network environment, a static file of a specified size is downloaded from a server corresponding to a preset IP, and an access speed is obtained during the downloading process.
可选地,所述网络访问失败的IP由DNS服务器解析所述访问域名得到。Optionally, the IP of the network access failure is obtained by parsing the access domain name by a DNS server.
依据本发明的另一方面,还提供了一种移动终端访问网络的装置,包括:According to another aspect of the present invention, a device for accessing a network by a mobile terminal is also provided, comprising:
监控模块,适于监控移动终端的网络访问事件;a monitoring module, suitable for monitoring network access events of the mobile terminal;
获取模块,适于当监控到所述移动终端网络访问失败时,获取网络访问失败的IP以及该IP对应的访问域名;an acquisition module, adapted to acquire the IP of the network access failure and the access domain name corresponding to the IP when monitoring that the mobile terminal fails to access the network;
查找模块,适于获取预先建立的域名与预设IP的第一对应关系,在所述第一对应关系中查找所述访问域名对应的预设IP,其中,所述预设IP与所述网络访问失败的IP不同;以及A search module, adapted to obtain a first correspondence between a pre-established domain name and a preset IP, and search for a preset IP corresponding to the access domain name in the first correspondence, wherein the preset IP is associated with the network The IP from which the access failed is different; and
访问模块,适于利用所述预设IP重新进行网络访问。The access module is adapted to use the preset IP to perform network access again.
可选地,所述装置还包括:Optionally, the device further includes:
第一建立模块,适于获取提供网络访问服务的多个服务器各自的域名和IP;对所述多个服务器各自的域名进行聚类,将域名相同的作为一类;以及根据聚类结果确定各个域名对应的一个或多个IP,以建立所述第一对应关系。The first establishment module is suitable for obtaining the respective domain names and IPs of multiple servers that provide network access services; clustering the respective domain names of the multiple servers, and taking the same domain names as a class; and determining each domain name according to the clustering result. One or more IPs corresponding to the domain name to establish the first corresponding relationship.
可选地,所述第一建立模块还适于:Optionally, the first establishment module is further adapted to:
接收云端服务器主动下发的提供网络访问服务的多个服务器各自的域名和IP;或者,Receive the respective domain names and IPs of multiple servers that provide network access services from the cloud server; or,
根据指定时间周期向云端服务器发送获取提供网络访问服务的多个服务器各自的域名和IP的请求,并接收所述云端服务器返回的包含所述多个服务器各自的域名和IP的响应信息。Send a request for obtaining the respective domain names and IPs of multiple servers providing network access services to the cloud server according to a specified time period, and receive response information returned by the cloud server including the respective domain names and IPs of the multiple servers.
可选地,所述访问模块包括:Optionally, the access module includes:
选取单元,适于若所述预设IP包括多个,根据预设优选策略,从多个所述预设IP中选取一个优选IP;以及A selection unit, adapted to select a preferred IP from the plurality of preset IPs according to a preset preference strategy if the preset IP includes multiple ones; and
访问单元,适于利用选取的所述优选IP重新进行网络访问。The access unit is adapted to use the selected preferred IP to perform network access again.
可选地,所述选取单元还适于:Optionally, the selection unit is further adapted to:
确定所述移动终端当前所处的网络环境;determining the network environment where the mobile terminal is currently located;
获取所述移动终端的网络环境与预设IP的第二对应关系,并根据所述第二对应关系,从多个所述预设IP中选取与所述移动终端当前所处的网络环境对应的预设IP作为备选IP;Obtain a second correspondence between the network environment of the mobile terminal and a preset IP, and select a network environment corresponding to the current network environment of the mobile terminal from a plurality of the preset IPs according to the second correspondence The default IP is used as an alternative IP;
若所述备选IP为一个,则将所述备选IP作为所述优选IP;以及If the alternative IP is one, the alternative IP is used as the preferred IP; and
若所述备选IP为多个,则从多个所述备选IP中选取一个作为所述优选IP。If there are multiple alternative IPs, select one of the multiple alternative IPs as the preferred IP.
可选地,所述装置还包括:Optionally, the device further includes:
第二建立模块,适于获取所述第一对应关系中包含的一个或多个预设IP;基于所述移动终端的网络环境,当所述移动终端处于所述网络环境时,测试所述移动终端对各个预设IP的访问路径是否连通;以及根据连通的访问路径对应的预设IP以及所述移动终端的网络环境,建立所述第二对应关系。The second establishment module is adapted to obtain one or more preset IPs included in the first correspondence; based on the network environment of the mobile terminal, when the mobile terminal is in the network environment, test the mobile terminal Whether the access paths of the terminal to each preset IP are connected; and establishing the second correspondence according to the preset IPs corresponding to the connected access paths and the network environment of the mobile terminal.
可选地,所述第二建立模块还适于:Optionally, the second establishment module is further adapted to:
确定连通的访问路径对应的预设IP各自对应的网络服务运营商;以及Determine the respective network service operators corresponding to the preset IPs corresponding to the connected access paths; and
从所述连通的访问路径对应的预设IP中,选取网络服务运营商与所述移动终端的网络环境一致的预设IP,并建立所述第二对应关系。From the preset IPs corresponding to the connected access paths, a preset IP that is consistent with the network service operator and the network environment of the mobile terminal is selected, and the second corresponding relationship is established.
可选地,所述选取单元还适于:Optionally, the selection unit is further adapted to:
获取多个所述备选IP各自对应的访问速度;以及Acquiring the respective access speeds of the multiple alternative IPs; and
从多个所述备选IP中选取访问速度最快的IP作为所述优选IP。The IP with the fastest access speed is selected from the multiple candidate IPs as the preferred IP.
可选地,所述第二对应关系中还包括所述预设IP与访问速度的对应关系,所述选取单元还适于:Optionally, the second correspondence also includes the correspondence between the preset IP and the access speed, and the selection unit is further adapted to:
从所述第二对应关系中,查找作为备选IP的多个预设IP各自对应的访问速度。From the second correspondence, search for the access speed corresponding to each of the multiple preset IPs serving as candidate IPs.
可选地,所述第二建立模块还适于:Optionally, the second establishment module is further adapted to:
基于所述移动终端的网络环境,当所述移动终端处于所述网络环境时,从预设IP对应的服务器处下载指定大小的静态文件,并在下载的过程中获取访问速度。Based on the network environment of the mobile terminal, when the mobile terminal is in the network environment, a static file of a specified size is downloaded from a server corresponding to a preset IP, and an access speed is obtained during the downloading process.
可选地,所述网络访问失败的IP由DNS服务器解析所述访问域名得到。Optionally, the IP of the network access failure is obtained by parsing the access domain name by a DNS server.
在本发明实施例中,对移动终端的网络访问事件进行监控,当监控到移动终端网络访问失败时,获取网络访问失败的IP以及该IP对应的访问域名。随后,获取域名与预设IP的第一对应关系,在第一对应关系中查找访问域名对应的预设IP,进而利用预设IP重新进行网络访问。由此可见,本发明实施例能够在移动终端网络访问失败时,获取访问域名对应的预设IP,并利用预设IP重新进行网络访问,从而解决了因域名解析错误或被劫持而导致的访问失败的问题。In the embodiment of the present invention, the network access event of the mobile terminal is monitored, and when it is monitored that the mobile terminal network access fails, the IP of the network access failure and the access domain name corresponding to the IP are obtained. Subsequently, the first correspondence between the domain name and the preset IP is obtained, the preset IP corresponding to the access domain name is searched in the first correspondence, and then the network access is performed again by using the preset IP. It can be seen that the embodiment of the present invention can obtain the preset IP corresponding to the access domain name when the mobile terminal fails to access the network, and use the preset IP to re-access the network, thereby solving the access caused by the domain name resolution error or hijacking Failed question.
进一步地,当在第一对应关系中查找到的预设IP存在多个时,本发明实施例还能够结合移动终端当前所处的网络环境从多个预设IP中选取一个优选IP,利用优选IP重新进行网络访问,使得移动终端能够实现快速、有效地网络访问。Further, when there are multiple preset IPs found in the first correspondence, this embodiment of the present invention can also select a preferred IP from the multiple preset IPs in combination with the network environment where the mobile terminal is currently located, and use the preferred IP. IP re-accesses the network, so that the mobile terminal can achieve fast and effective network access.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solutions of the present invention. In order to understand the technical means of the present invention more clearly, it can be implemented according to the content of the description, and in order to make the above and other objects, features and advantages of the present invention more obvious and easy to understand , the following specific embodiments of the present invention are given.
根据下文结合附图对本发明具体实施例的详细描述,本领域技术人员将会更加明了本发明的上述以及其他目的、优点和特征。The above and other objects, advantages and features of the present invention will be more apparent to those skilled in the art from the following detailed description of the specific embodiments of the present invention in conjunction with the accompanying drawings.
附图说明Description of drawings
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are for the purpose of illustrating preferred embodiments only and are not to be considered limiting of the invention. Also, the same components are denoted by the same reference numerals throughout the drawings. In the attached image:
图1示出了根据本发明一个实施例的移动终端访问网络的方法的流程示意图;1 shows a schematic flowchart of a method for a mobile terminal to access a network according to an embodiment of the present invention;
图2示出了根据本发明一个实施例的移动终端访问网络的装置的结构示意图;以及FIG. 2 shows a schematic structural diagram of an apparatus for a mobile terminal to access a network according to an embodiment of the present invention; and
图3示出了根据本发明另一个实施例的移动终端访问网络的装置的结构示意图。FIG. 3 shows a schematic structural diagram of an apparatus for a mobile terminal to access a network according to another embodiment of the present invention.
具体实施方式Detailed ways
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be more thoroughly understood, and will fully convey the scope of the present disclosure to those skilled in the art.
如前文所述,目前移动终端在进行网络访问时,若遇到域名解析错误或被劫持,则会导致网络访问失败,无法完成网络访问。为了解决这一技术问题,本发明实施例提供了一种移动终端访问网络的方法。图1示出了根据本发明一个实施例的移动终端访问网络的方法的流程示意图。如图1所示,该方法至少可以包括步骤S102、步骤S104、步骤S106以及步骤S108:As mentioned above, when the mobile terminal currently accesses the network, if it encounters a domain name resolution error or is hijacked, the network access will fail and the network access cannot be completed. In order to solve this technical problem, an embodiment of the present invention provides a method for a mobile terminal to access a network. FIG. 1 shows a schematic flowchart of a method for a mobile terminal to access a network according to an embodiment of the present invention. As shown in FIG. 1, the method may include at least step S102, step S104, step S106 and step S108:
步骤S102,监控移动终端的网络访问事件;Step S102, monitoring network access events of the mobile terminal;
步骤S104,当监控到移动终端网络访问失败时,获取网络访问失败的IP以及该IP对应的访问域名;Step S104, when monitoring the network access failure of the mobile terminal, obtain the IP of the network access failure and the access domain name corresponding to the IP;
步骤S106,获取预先建立的域名与预设IP的第一对应关系,在第一对应关系中查找访问域名对应的预设IP,其中,预设IP与网络访问失败的IP不同;以及Step S106, obtaining a first correspondence between a pre-established domain name and a preset IP, and searching for a preset IP corresponding to the access domain name in the first correspondence, wherein the preset IP is different from the IP that fails to access the network; and
步骤S108,利用预设IP重新进行网络访问。Step S108, using the preset IP to perform network access again.
在本发明实施例中,对移动终端的网络访问事件进行监控,当监控到移动终端网络访问失败时,获取网络访问失败的IP以及该IP对应的访问域名。随后,获取预先建立的域名与预设IP的第一对应关系,在第一对应关系中查找访问域名对应的预设IP,进而利用预设IP重新进行网络访问。由此可见,本发明实施例能够在移动终端网络访问失败时,获取访问域名对应的预设IP,并利用预设IP重新进行网络访问,从而解决了因域名解析错误或被劫持而导致的访问失败的问题。In the embodiment of the present invention, the network access event of the mobile terminal is monitored, and when it is monitored that the mobile terminal network access fails, the IP of the network access failure and the access domain name corresponding to the IP are obtained. Then, a pre-established first correspondence between the domain name and the preset IP is obtained, the preset IP corresponding to the access domain name is searched in the first correspondence, and then the network access is performed again by using the preset IP. It can be seen that the embodiment of the present invention can obtain the preset IP corresponding to the access domain name when the mobile terminal fails to access the network, and use the preset IP to re-access the network, thereby solving the access caused by the domain name resolution error or hijacking Failed question.
上文步骤S102中提及的网络访问事件可以是数据资源下载、页面浏览等事件,本发明对此不作限制。在移动终端中,通过其上安装的各个应用来进行网络访问,因而在监控移动终端的网络访问事件时,可以具体监控各个应用的网络访问事件。例如,移动终端上安装有手机助手应用,该应用通常会进行各种跨网络的数据资源下载,如下载游戏、即时通讯等应用的安装包,这种下载最先需要对域名进行解析,得到服务器的IP,从而连接对应的IP以下载所需的内容,因而本发明实施例可以监控手机助手应用的数据资源下载事件。The network access event mentioned in the above step S102 may be events such as data resource download, page browsing, etc., which is not limited in the present invention. In the mobile terminal, network access is performed through various applications installed on the mobile terminal, so when monitoring the network access events of the mobile terminal, the network access events of each application can be specifically monitored. For example, a mobile phone assistant application is installed on the mobile terminal, and the application usually downloads various data resources across the network, such as downloading the installation packages of applications such as games and instant messaging. Therefore, the embodiment of the present invention can monitor the data resource download event of the mobile phone assistant application.
当监控到移动终端网络访问失败时,步骤S104获取网络访问失败的IP以及该IP对应的访问域名,可选地,这里的网络访问失败的IP是由DNS服务器解析访问域名得到。DNS是计算机域名系统(Domain Name System或Domain Name Service)的缩写,它是由解析器和域名服务器组成的。域名服务器是指保存有该网络中所有主机的域名和对应IP地址,并具有将域名转换为IP地址功能的服务器。When it is monitored that the mobile terminal fails to access the network, step S104 obtains the IP of the failed network access and the access domain name corresponding to the IP. Optionally, the IP of the network access failure here is obtained by parsing the access domain name by the DNS server. DNS is the abbreviation of computer domain name system (Domain Name System or Domain Name Service), which is composed of resolvers and domain name servers. A domain name server refers to a server that stores the domain names and corresponding IP addresses of all hosts in the network, and has the function of converting domain names into IP addresses.
进一步地,步骤S106获取预先建立的域名与预设IP的第一对应关系,在第一对应关系中查找访问域名对应的预设IP,这里,本发明实施例提供了一种可选的方案来建立第一对应关系,在该可选的方案中,首先获取提供网络访问服务的多个服务器各自的域名和IP,其次对多个服务器各自的域名进行聚类,将域名相同的作为一类,进而根据聚类结果确定各个域名对应的一个或多个IP,以建立第一对应关系。例如,获取到提供网络访问服务的服务器有服务器1、服务器2、服务器3以及服务器4,它们各自的域名分别为域名a、域名a、域名b、域名c,各自的IP分别为IP1、IP2、IP3、IP4。随后,对服务器1、2、3和4各自的域名进行聚类,将域名相同的作为一类,进而根据聚类结果确定各个域名对应的一个或多个IP,即,域名a对应IP1和IP2,域名b对应IP3以及域名c对应IP4,可以参见下表1所示。需要说明的是,表1中的例举仅是示意性的,并不对本发明进行限制。Further, step S106 obtains the first correspondence between the pre-established domain name and the preset IP, and searches for the preset IP corresponding to the access domain name in the first correspondence. Here, the embodiment of the present invention provides an optional solution to Establish a first correspondence. In this optional solution, first obtain the respective domain names and IPs of multiple servers that provide network access services, and secondly cluster the respective domain names of the multiple servers, taking the same domain name as a class, Further, according to the clustering result, one or more IPs corresponding to each domain name are determined to establish a first correspondence. For example, the obtained servers that provide network access services include server 1, server 2, server 3, and server 4. Their respective domain names are domain name a, domain name a, domain name b, and domain name c, respectively, and their respective IP addresses are IP1, IP2, IP3, IP4. Then, cluster the respective domain names of servers 1, 2, 3 and 4, take the same domain name as a class, and then determine one or more IPs corresponding to each domain name according to the clustering result, that is, domain name a corresponds to IP1 and IP2 , the domain name b corresponds to IP3 and the domain name c corresponds to IP4, as shown in Table 1 below. It should be noted that the examples in Table 1 are only illustrative, and do not limit the present invention.
表1Table 1
在本发明的可选实施例中,云端服务器收集和管理提供网络访问服务的各个服务器各自的域名和IP,能够提高数据管理的效率。因而,在上述建立第一对应关系的方案中,获取提供网络访问服务的多个服务器各自的域名和IP可以是主动或被动地从云端服务器处获取,例如,可以根据指定时间周期(如1小时或1天等)向云端服务器发送获取提供网络访问服务的多个服务器各自的域名和IP的请求,并接收云端服务器返回的包含多个服务器各自的域名和IP的响应信息;又例如,可以接收云端服务器主动下发的提供网络访问服务的多个服务器各自的域名和IP,这里,云端服务器可以定期或不定期的主动下发,当云端服务器中存在提供网络访问服务的服务器的域名和IP发生变更时,则云端服务器主动向移动终端下发该服务器的域名和IP的变更信息,以便移动终端根据变更信息对提供网络访问服务的服务器的域名和IP进行动态更新。In an optional embodiment of the present invention, the cloud server collects and manages the respective domain names and IPs of each server that provides network access services, which can improve the efficiency of data management. Therefore, in the above-mentioned solution for establishing the first correspondence, obtaining the respective domain names and IPs of multiple servers that provide network access services can be obtained from the cloud server actively or passively, for example, according to a specified time period (such as 1 hour or 1 day, etc.) send a request to the cloud server to obtain the respective domain names and IPs of multiple servers that provide network access services, and receive the response information returned by the cloud server containing the respective domain names and IPs of multiple servers; for example, you can receive The domain names and IPs of multiple servers that provide network access services are actively issued by the cloud server. Here, the cloud server can be actively issued regularly or irregularly. When the cloud server has the domain name and IP of the server that provides network access services When it is changed, the cloud server actively sends the change information of the domain name and IP of the server to the mobile terminal, so that the mobile terminal can dynamically update the domain name and IP of the server providing the network access service according to the change information.
在本发明的可选实施例中,由于预先建立有域名与预设IP的第一对应关系,该第一对应关系中一个域名可能对应多个预设IP,因而步骤S104中提及的网络访问失败的IP也可能是来自第一对应关系中的预设IP,此时,在步骤S106在第一对应关系中查找访问域名对应的预设IP时要排除该网络访问失败的IP,以确保利用预设IP重新进行网络访问时不会再次访问失败。例如,网络访问失败的IP来自第一对应关系中的第一预设IP,该第一预设IP对应的访问域名为域名1,在第一对应关系中查找访问域名1对应有第一预设IP和第二预设IP,此时需排除第一预设IP,选取第二预设IP重新进行网络访问。进一步地,由于第一预设IP为网络访问失败的IP,因而可以在第一对应关系中删除该第一预设IP,以在后续查找第一对应关系进行域名解析时,不会选取到该第一预设IP而导致网络访问失败。In an optional embodiment of the present invention, since a first correspondence between domain names and preset IPs is pre-established, one domain name in the first correspondence may correspond to multiple preset IPs, so the network access mentioned in step S104 The failed IP may also be the preset IP from the first corresponding relationship. At this time, in step S106, when searching for the preset IP corresponding to the access domain name in the first corresponding relationship, the IP that failed to access the network should be excluded to ensure that the network access fails. The default IP will not fail to access again when re-accessing the network. For example, the IP that fails to access the network comes from the first preset IP in the first corresponding relationship, the access domain name corresponding to the first preset IP is domain name 1, and the access domain name 1 in the first corresponding relationship corresponds to the first preset IP and the second preset IP. At this time, the first preset IP needs to be excluded, and the second preset IP is selected to perform network access again. Further, since the first preset IP is an IP that fails to access the network, the first preset IP can be deleted in the first corresponding relationship, so that when the first corresponding relationship is searched for domain name resolution, the first preset IP will not be selected. The first preset IP causes network access failure.
在本发明的可选实施例中,若步骤S106在第一对应关系中查找到的访问域名对应的预设IP包括多个,则步骤S108利用预设IP重新进行网络访问时,可以根据预设优选策略,从多个预设IP中选取一个优选IP,进而利用选取的优选IP重新进行网络访问。这里,可以采用随机选取的方式选取优选IP,也可以根据移动终端的地理位置、当前网络环境等选取优选IP,下面将分别进行详细介绍。In an optional embodiment of the present invention, if the preset IP corresponding to the access domain name found in the first correspondence relationship in step S106 includes multiple, then in step S108, when using the preset IP to re-access the network, the preset IP can be used according to the preset IP. The preferred strategy is to select a preferred IP from multiple preset IPs, and then use the selected preferred IP to perform network access again. Here, the preferred IP may be selected randomly, or the preferred IP may be selected according to the geographic location of the mobile terminal, the current network environment, etc., which will be described in detail below.
方式一,在根据移动终端的地理位置选取优选IP时,首先获取移动终端的当前地理位置,进而从多个预设IP中选取地理位置与移动终端的当前地理位置最近的为优选IP。Manner 1: When selecting the preferred IP according to the geographic location of the mobile terminal, first obtain the current geographic location of the mobile terminal, and then select the preferred IP from a plurality of preset IPs whose geographic location is closest to the current geographic location of the mobile terminal.
方式二,在根据移动终端的当前网络环境选取优选IP时,首先确定移动终端当前所处的网络环境,随后获取移动终端的网络环境与预设IP的第二对应关系,并根据第二对应关系,从多个预设IP中选取与移动终端当前所处的网络环境对应的预设IP作为备选IP。若备选IP为一个,则将备选IP作为优选IP;以及若备选IP为多个,则从多个备选IP中选取一个作为优选IP。Mode 2: When selecting the preferred IP according to the current network environment of the mobile terminal, first determine the network environment where the mobile terminal is currently located, then obtain a second correspondence between the network environment of the mobile terminal and the preset IP, and then obtain the second correspondence between the network environment of the mobile terminal and the preset IP. , selecting a preset IP corresponding to the network environment where the mobile terminal is currently located from the multiple preset IPs as the candidate IP. If there is one candidate IP, the candidate IP is used as the preferred IP; and if there are multiple candidate IPs, one candidate IP is selected from the multiple candidate IPs as the preferred IP.
本发明实施例提供了一种可选的方案以建立上述第二对应关系,即,首先获取第一对应关系中包含的一个或多个预设IP,随后基于移动终端的网络环境,当移动终端处于该网络环境时,测试移动终端对各个预设IP的访问路径是否连通,进而根据连通的访问路径对应的预设IP以及移动终端的网络环境,建立第二对应关系。在这里,本发明实施例能够针对不同的移动终端,结合各个移动终端自身的实际网络环境为各个移动终端建立第二对应关系,并利用第二对应关系选取优选IP重新进行网络访问,解决了因域名解析错误或被劫持而导致的访问失败的问题。具体地,本发明实施例建立的第二对应关系可以参见如下表2所示,需要说明的是,下表2中的例举仅是示意性的,并不对本发明进行限制。The embodiment of the present invention provides an optional solution to establish the above-mentioned second correspondence, that is, first obtain one or more preset IPs included in the first correspondence, and then, based on the network environment of the mobile terminal, when the mobile terminal When in the network environment, test whether the access paths of the mobile terminal to each preset IP are connected, and then establish a second correspondence according to the preset IPs corresponding to the connected access paths and the network environment of the mobile terminal. Here, the embodiment of the present invention can establish a second corresponding relationship for each mobile terminal for different mobile terminals in combination with the actual network environment of each mobile terminal, and use the second corresponding relationship to select a preferred IP for network access again, which solves the problem. The problem of access failure caused by domain name resolution errors or hijacking. Specifically, the second correspondence established in the embodiment of the present invention can be referred to as shown in Table 2 below. It should be noted that the examples in Table 2 are only schematic and do not limit the present invention.
表2Table 2
这里,结合表2对上述方式二的实施过程进行举例说明,假设步骤S106在第一对应关系中查找到访问域名a(即,网络访问失败的IP对应的访问域名)对应的预设IP为IP1和IP2,方式二中确定移动终端当前所处的网络环境为网络环境2,从表2中查找到网络环境2中移动终端对IP1的访问路径是连通的,移动终端对IP2的访问路径不连通,则确定IP1为优选IP,进而利用IP1重新进行网络访问。另外,在表2中,也可以仅保存连通的访问路径对应的预设IP以及移动终端的网络环境,对于不连通的访问路径对应的预设IP(如,网络环境2下域名a对应的IP2)可以删除,不进行保存。Here, the implementation process of the above-mentioned mode 2 is illustrated with reference to Table 2. It is assumed that the preset IP corresponding to the access domain name a (that is, the access domain name corresponding to the IP that fails to access the network) is found in the first correspondence in step S106 as IP1 With IP2, in the mode 2, it is determined that the current network environment of the mobile terminal is network environment 2, and it is found from Table 2 that the access path of the mobile terminal to IP1 in the network environment 2 is connected, and the access path of the mobile terminal to IP2 is not connected, Then, it is determined that IP1 is the preferred IP, and then use IP1 to perform network access again. In addition, in Table 2, it is also possible to only save the preset IP corresponding to the connected access path and the network environment of the mobile terminal. ) can be deleted without saving.
此外,第二对应关系可以是预先建立的,也可以是当前临时创建的。若第二对应关系是预先建立的,则第二对应关系有保存时间的限制,本发明实施例会对第二对应关系进行定期或不定期地动态更新。例如,如前文介绍,第一对应关系中的域名和预设IP会有更新(如增加、删除或修改等),那么当第一对应关系中的域名和预设IP发生更新时,本发明实施例会更新获取的预设IP。假设是增加预设IP,则本发明实施例会测试移动终端处于不同的网络环境时,移动终端对该增加的预设IP的访问路径是否连通,并更新到第二对应关系中;假设是删除预设IP,则本发明实施例会直接在第二对应关系中剔除该删除的预设IP;假设是修改预设IP,则本发明实施例会在第二对应关系中将原先预设IP调整为修改的预设IP,并会测试移动终端处于不同的网络环境时,移动终端对该修改的预设IP的访问路径是否连通,并更新到第二对应关系中。又例如,考虑到网络中存在的不稳定因素导致网络访问不连通,本发明实施例还会定期或不定期的对第二对应关系中各个预设IP的访问路径的连通性进行重新测试,并根据测试结果进行更新。In addition, the second correspondence relationship may be pre-established, or may be temporarily created at present. If the second corresponding relationship is pre-established, the second corresponding relationship has a storage time limit, and the embodiment of the present invention will dynamically update the second corresponding relationship on a regular or irregular basis. For example, as described above, the domain name and the preset IP in the first corresponding relationship will be updated (such as adding, deleting or modifying, etc.), then when the domain name and the preset IP in the first corresponding relationship are updated, the present invention implements Example will update the obtained default IP. Assuming that the preset IP is added, the embodiment of the present invention will test whether the access path of the mobile terminal to the added preset IP is connected when the mobile terminal is in a different network environment, and update it to the second correspondence; assuming that the preset IP is deleted If IP is set, the embodiment of the present invention will directly remove the deleted preset IP in the second correspondence; if the preset IP is to be modified, the embodiment of the present invention will adjust the original preset IP to the modified one in the second correspondence The preset IP is tested, and when the mobile terminal is in a different network environment, whether the access path of the mobile terminal to the modified preset IP is connected, and the second corresponding relationship is updated. For another example, considering that unstable factors existing in the network cause network access to be disconnected, the embodiment of the present invention also periodically or irregularly re-tests the connectivity of the access paths of each preset IP in the second correspondence, and retests the connectivity of the access paths. Update based on test results.
本发明实施例提及的移动终端的网络环境可以是各种无线局域网络,如wifi、蓝牙等,也可以是运营商提供的移动数据网络,等等,本发明不限于此。通常情况下,相同网络环境下的访问效率高于跨网络访问,为了进一步提高网络访问效率,本发明实施例还可以确定连通的访问路径对应的预设IP各自对应的网络服务运营商,并从连通的访问路径对应的预设IP中,选取网络服务运营商与移动终端的网络环境一致的预设IP,并建立第二对应关系。在表2的基础上,这里建立的第二对应关系如下表3所示。The network environment of the mobile terminal mentioned in the embodiments of the present invention may be various wireless local area networks, such as wifi, Bluetooth, etc., or may be a mobile data network provided by an operator, etc., and the present invention is not limited thereto. In general, the access efficiency in the same network environment is higher than the cross-network access. In order to further improve the network access efficiency, the embodiment of the present invention can also determine the network service operators corresponding to the preset IPs corresponding to the connected access paths, and from Among the preset IPs corresponding to the connected access paths, a preset IP that is consistent with the network environment of the network service operator and the mobile terminal is selected, and a second corresponding relationship is established. On the basis of Table 2, the second correspondence established here is shown in Table 3 below.
表3table 3
这里,结合表3对上述方式二的实施过程进行举例说明,假设步骤S106在第一对应关系中查找到访问域名a(即,网络访问失败的IP对应的访问域名)对应的预设IP为IP1和IP2,方式二中确定移动终端当前所处的网络环境为网络环境1(即,运营商A),从表3中查找到网络环境1中的IP1是对应运营商A的,IP2是对应运营商B的,则确定IP1为优选IP,进而利用IP1重新进行网络访问。另外,在表3中,也可以仅保存网络服务运营商与移动终端的网络环境一致的预设IP,对于网络服务运营商与移动终端的网络环境不一致的预设IP可以删除,不进行保存,如表3中,网络环境1为运营商A,可以删除网络环境1下域名a对应的IP2(IP2对应运营商B)。Here, the implementation process of the above-mentioned mode 2 is illustrated with reference to Table 3. It is assumed that the preset IP corresponding to the access domain name a (that is, the access domain name corresponding to the IP that fails to access the network) is found in the first correspondence in step S106 as IP1 and IP2, in the second way, it is determined that the network environment where the mobile terminal is currently located is network environment 1 (that is, operator A), and it is found from Table 3 that IP1 in network environment 1 corresponds to operator A, and IP2 corresponds to operator A. Business B, then determine IP1 as the preferred IP, and then use IP1 to access the network again. In addition, in Table 3, it is also possible to only save the preset IPs that are consistent with the network environment of the network service operator and the mobile terminal, and the preset IPs that are inconsistent with the network environment of the network service operator and the mobile terminal can be deleted without saving. As shown in Table 3, the network environment 1 is the operator A, and the IP2 corresponding to the domain name a in the network environment 1 can be deleted (IP2 corresponds to the operator B).
在本发明的另一可选实施例中,还可以结合访问速度来从多个备选IP中选取一个作为优选IP。具体地,在第二对应关系中存储了预设IP与访问速度的对应关系,如下表4所示,从而可以从第二对应关系中,查找作为备选IP的多个预设IP各自对应的访问速度,从多个备选IP中选取访问速度最快的IP作为优选IP。需要说明的是,表4是在表3的基础上建立的,仅是用于示意的,并不限制本发明。在实际应用中,还可以结合运营商和访问速度进行综合选取优选IP,本发明并不限制这些选取策略的先后顺序。In another optional embodiment of the present invention, one of multiple candidate IPs may also be selected as the preferred IP in combination with the access speed. Specifically, the corresponding relationship between the preset IP and the access speed is stored in the second corresponding relationship, as shown in Table 4 below, so that from the second corresponding relationship, it is possible to search for the corresponding ones of the multiple preset IPs serving as candidate IPs. Access speed, select the IP with the fastest access speed from multiple alternative IPs as the preferred IP. It should be noted that Table 4 is established on the basis of Table 3, and is only used for illustration and does not limit the present invention. In practical applications, it is also possible to comprehensively select the preferred IP in combination with the operator and the access speed, and the present invention does not limit the sequence of these selection strategies.
表4Table 4
本发明实施例还提供了一种可选的方案来确定预设IP对应的访问速度,即,基于移动终端的网络环境,当移动终端处于该网络环境时,从预设IP对应的服务器处下载指定大小的静态文件,并在下载的过程中获取访问速度。The embodiment of the present invention also provides an optional solution to determine the access speed corresponding to the preset IP, that is, based on the network environment of the mobile terminal, when the mobile terminal is in the network environment, download from the server corresponding to the preset IP. Static files of a specified size and get access speed during the download.
在本发明的可选实施例中,若步骤S108中利用预设IP重新进行网络访问时仍然访问网络失败,则可以在第一对应关系中删除该网络访问失败的IP,并重新从第一对应关系中查找访问域名对应的预设IP,直至网络访问成功。In an optional embodiment of the present invention, if the network access still fails when the preset IP is used to access the network again in step S108, the IP of the network access failure may be deleted from the first correspondence relationship, and the first correspondence Find the preset IP corresponding to the access domain name in the relationship until the network access is successful.
需要说明的是,在实际应用中,上述所有可选实施方式可以采用结合的方式任意组合,形成本发明的可选实施例,在此不再一一赘述。It should be noted that, in practical applications, all the above-mentioned optional embodiments may be combined arbitrarily in a combined manner to form optional embodiments of the present invention, which will not be repeated here.
基于上文各个实施例提供的移动终端访问网络的方法,基于同一发明构思,本发明实施例还提供了一种移动终端访问网络的装置。Based on the methods for accessing a network by a mobile terminal provided by the above embodiments, and based on the same inventive concept, an embodiment of the present invention further provides an apparatus for accessing a network by a mobile terminal.
图2示出了根据本发明一个实施例的移动终端访问网络的装置的结构示意图。如图2所示,该装置200至少可以包括监控模块210、获取模块220、查找模块230以及访问模块240。FIG. 2 shows a schematic structural diagram of an apparatus for a mobile terminal to access a network according to an embodiment of the present invention. As shown in FIG. 2 , the apparatus 200 may at least include a
现介绍本发明实施例的移动终端访问网络的装置200的各组成或器件的功能以及各部分间的连接关系:Now, the functions of each component or device of the apparatus 200 for accessing a network by a mobile terminal according to the embodiment of the present invention and the connection relationship between the various components are introduced:
监控模块210,适于监控移动终端的网络访问事件;a
获取模块220,与监控模块210相耦合,适于当监控到所述移动终端网络访问失败时,获取网络访问失败的IP以及该IP对应的访问域名;The obtaining
查找模块230,与获取模块220相耦合,适于获取预先建立的域名与预设IP的第一对应关系,在所述第一对应关系中查找所述访问域名对应的预设IP,其中,所述预设IP与所述网络访问失败的IP不同;以及The searching
访问模块240,与查找模块230相耦合,适于利用所述预设IP重新进行网络访问。The
在本发明一实施例中,如图3所示,移动终端访问网络的装置300除了包括图2展示的各个模块之外,还可以包括:In an embodiment of the present invention, as shown in FIG. 3 , the apparatus 300 for accessing a network by a mobile terminal may further include, in addition to the modules shown in FIG. 2 :
第一建立模块250,与查找模块230相耦合,适于获取提供网络访问服务的多个服务器各自的域名和IP;对所述多个服务器各自的域名进行聚类,将域名相同的作为一类;以及根据聚类结果确定各个域名对应的一个或多个IP,以建立所述第一对应关系。The
在本发明一实施例中,上述第一建立模块250还适于:In an embodiment of the present invention, the above-mentioned first establishing
接收云端服务器主动下发的提供网络访问服务的多个服务器各自的域名和IP;或者,Receive the respective domain names and IPs of multiple servers that provide network access services from the cloud server; or,
根据指定时间周期向云端服务器发送获取提供网络访问服务的多个服务器各自的域名和IP的请求,并接收所述云端服务器返回的包含所述多个服务器各自的域名和IP的响应信息。Send a request for obtaining the respective domain names and IPs of multiple servers providing network access services to the cloud server according to a specified time period, and receive response information returned by the cloud server including the respective domain names and IPs of the multiple servers.
在本发明一实施例中,如图3所示,上述访问模块240可以包括:In an embodiment of the present invention, as shown in FIG. 3 , the foregoing
选取单元241,适于若所述预设IP包括多个,根据预设优选策略,从多个所述预设IP中选取一个优选IP;以及A
访问单元242,适于利用选取的所述优选IP重新进行网络访问。The
在本发明一实施例中,选取单元241还适于:In an embodiment of the present invention, the
确定所述移动终端当前所处的网络环境;determining the network environment where the mobile terminal is currently located;
获取所述移动终端的网络环境与预设IP的第二对应关系,并根据所述第二对应关系,从多个所述预设IP中选取与所述移动终端当前所处的网络环境对应的预设IP作为备选IP;Obtain a second correspondence between the network environment of the mobile terminal and a preset IP, and select a network environment corresponding to the current network environment of the mobile terminal from a plurality of the preset IPs according to the second correspondence The default IP is used as an alternative IP;
若所述备选IP为一个,则将所述备选IP作为所述优选IP;以及If the alternative IP is one, the alternative IP is used as the preferred IP; and
若所述备选IP为多个,则从多个所述备选IP中选取一个作为所述优选IP。If there are multiple alternative IPs, select one of the multiple alternative IPs as the preferred IP.
在本发明一实施例中,如图3所示,移动终端访问网络的装置300还可以包括:In an embodiment of the present invention, as shown in FIG. 3 , the apparatus 300 for the mobile terminal to access the network may further include:
第二建立模块260,与第一建立模块250、选取单元241相耦合,适于获取所述第一对应关系中包含的一个或多个预设IP;基于所述移动终端的网络环境,当所述移动终端处于所述网络环境时,测试所述移动终端对各个预设IP的访问路径是否连通;以及根据连通的访问路径对应的预设IP以及所述移动终端的网络环境,建立所述第二对应关系。The
在本发明一实施例中,上述第二建立模块260还适于:In an embodiment of the present invention, the above-mentioned
确定连通的访问路径对应的预设IP各自对应的网络服务运营商;以及Determine the respective network service operators corresponding to the preset IPs corresponding to the connected access paths; and
从所述连通的访问路径对应的预设IP中,选取网络服务运营商与所述移动终端的网络环境一致的预设IP,并建立所述第二对应关系。From the preset IPs corresponding to the connected access paths, a preset IP that is consistent with the network service operator and the network environment of the mobile terminal is selected, and the second corresponding relationship is established.
在本发明一实施例中,选取单元241还适于:In an embodiment of the present invention, the
获取多个所述备选IP各自对应的访问速度;以及Acquiring the respective access speeds of the multiple alternative IPs; and
从多个所述备选IP中选取访问速度最快的IP作为所述优选IP。The IP with the fastest access speed is selected from the multiple candidate IPs as the preferred IP.
在本发明一实施例中,所述第二对应关系中还包括所述预设IP与访问速度的对应关系,选取单元241还适于:In an embodiment of the present invention, the second correspondence also includes the correspondence between the preset IP and the access speed, and the
从所述第二对应关系中,查找作为备选IP的多个预设IP各自对应的访问速度。From the second correspondence, search for the access speed corresponding to each of the multiple preset IPs serving as candidate IPs.
在本发明一实施例中,上述第二建立模块260还适于:In an embodiment of the present invention, the above-mentioned
基于所述移动终端的网络环境,当所述移动终端处于所述网络环境时,从预设IP对应的服务器处下载指定大小的静态文件,并在下载的过程中获取访问速度。Based on the network environment of the mobile terminal, when the mobile terminal is in the network environment, a static file of a specified size is downloaded from a server corresponding to a preset IP, and an access speed is obtained during the downloading process.
在本发明一实施例中,所述网络访问失败的IP由DNS服务器解析所述访问域名得到。In an embodiment of the present invention, the IP of the network access failure is obtained by parsing the access domain name by a DNS server.
根据上述任意一个优选实施例或多个优选实施例的组合,本发明实施例能够达到如下有益效果:According to any one of the above-mentioned preferred embodiments or a combination of multiple preferred embodiments, the embodiments of the present invention can achieve the following beneficial effects:
在本发明实施例中,对移动终端的网络访问事件进行监控,当监控到移动终端网络访问失败时,获取网络访问失败的IP以及该IP对应的访问域名。随后,获取预先建立的域名与预设IP的第一对应关系,在第一对应关系中查找访问域名对应的预设IP,进而利用预设IP重新进行网络访问。由此可见,本发明实施例能够在移动终端网络访问失败时,获取访问域名对应的预设IP,并利用预设IP重新进行网络访问,从而解决了因域名解析错误或被劫持而导致的访问失败的问题。In the embodiment of the present invention, the network access event of the mobile terminal is monitored, and when it is monitored that the mobile terminal network access fails, the IP of the network access failure and the access domain name corresponding to the IP are obtained. Then, a pre-established first correspondence between the domain name and the preset IP is obtained, the preset IP corresponding to the access domain name is searched in the first correspondence, and then the network access is performed again by using the preset IP. It can be seen that the embodiment of the present invention can obtain the preset IP corresponding to the access domain name when the mobile terminal fails to access the network, and use the preset IP to re-access the network, thereby solving the access caused by the domain name resolution error or hijacking Failed question.
进一步地,当在第一对应关系中查找到的预设IP存在多个时,本发明实施例还能够结合移动终端当前所处的网络环境从多个预设IP中选取一个优选IP,利用优选IP重新进行网络访问,使得移动终端能够实现快速、有效地网络访问。Further, when there are multiple preset IPs found in the first correspondence, the embodiment of the present invention can also select a preferred IP from the multiple preset IPs in combination with the network environment where the mobile terminal is currently located, and use the preferred IP. IP re-accesses the network, enabling the mobile terminal to achieve fast and effective network access.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. It will be understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it is to be understood that in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together into a single embodiment, Figure, or its description. This disclosure, however, should not be construed as reflecting an intention that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art will understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. The modules or units or components in the embodiments may be combined into one module or unit or component, and further they may be divided into multiple sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method so disclosed may be employed in any combination, unless at least some of such features and/or procedures or elements are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, those skilled in the art will appreciate that although some of the embodiments described herein include certain features, but not others, included in other embodiments, that combinations of features of different embodiments are intended to be within the scope of the invention within and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的移动终端访问网络的装置中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。Various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components in the apparatus for accessing a network by a mobile terminal according to an embodiment of the present invention. The present invention can also be implemented as apparatus or apparatus programs (eg, computer programs and computer program products) for performing part or all of the methods described herein. Such a program implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such signals may be downloaded from Internet sites, or provided on carrier signals, or in any other form.
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-described embodiments illustrate rather than limit the invention, and that alternative embodiments may be devised by those skilled in the art without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. do not denote any order. These words can be interpreted as names.
至此,本领域技术人员应认识到,虽然本文已详尽示出和描述了本发明的多个示例性实施例,但是,在不脱离本发明精神和范围的情况下,仍可根据本发明公开的内容直接确定或推导出符合本发明原理的许多其他变型或修改。因此,本发明的范围应被理解和认定为覆盖了所有这些其他变型或修改。By now, those skilled in the art will recognize that, although various exemplary embodiments of the present invention have been illustrated and described in detail herein, the present invention may still be implemented in accordance with the present disclosure without departing from the spirit and scope of the present invention. The content directly determines or derives many other variations or modifications consistent with the principles of the invention. Accordingly, the scope of the present invention should be understood and deemed to cover all such other variations or modifications.
Claims (16)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610513275.4A CN105991797B (en) | 2016-07-01 | 2016-07-01 | Method and device for mobile terminal to access network |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610513275.4A CN105991797B (en) | 2016-07-01 | 2016-07-01 | Method and device for mobile terminal to access network |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105991797A CN105991797A (en) | 2016-10-05 |
CN105991797B true CN105991797B (en) | 2019-10-15 |
Family
ID=57044142
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610513275.4A Active CN105991797B (en) | 2016-07-01 | 2016-07-01 | Method and device for mobile terminal to access network |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105991797B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106506727B (en) * | 2016-12-28 | 2019-04-12 | 北京奇艺世纪科技有限公司 | A kind of method and system for the local domain name system positioning domain name mapping mistake |
CN107154963B (en) * | 2017-03-31 | 2021-01-29 | 北京猎豹移动科技有限公司 | Request processing method and device and electronic equipment |
CN109218353A (en) * | 2017-06-30 | 2019-01-15 | 苏宁云商集团股份有限公司 | A kind of method and device of link establishment |
CN110858143B (en) * | 2018-08-22 | 2023-07-28 | 广州虎牙信息科技有限公司 | Installation package generation method, device, equipment and storage medium |
CN110677506B (en) * | 2019-08-21 | 2022-10-11 | 中国平安财产保险股份有限公司 | Network access method, device, computer equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103124265A (en) * | 2013-01-31 | 2013-05-29 | 深信服网络科技(深圳)有限公司 | Method for visiting websites and gateway device |
CN103595825A (en) * | 2013-10-25 | 2014-02-19 | 北京奇虎科技有限公司 | Domain name resolution detection method, domain name resolution detection device and server |
CN103957283A (en) * | 2011-09-29 | 2014-07-30 | 北京奇虎科技有限公司 | Optimal-application-server selection method and device for domain name system |
CN104158919A (en) * | 2014-08-20 | 2014-11-19 | 安一恒通(北京)科技有限公司 | Webpage access implementation method, server and client |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9634993B2 (en) * | 2010-04-01 | 2017-04-25 | Cloudflare, Inc. | Internet-based proxy service to modify internet responses |
-
2016
- 2016-07-01 CN CN201610513275.4A patent/CN105991797B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103957283A (en) * | 2011-09-29 | 2014-07-30 | 北京奇虎科技有限公司 | Optimal-application-server selection method and device for domain name system |
CN103124265A (en) * | 2013-01-31 | 2013-05-29 | 深信服网络科技(深圳)有限公司 | Method for visiting websites and gateway device |
CN103595825A (en) * | 2013-10-25 | 2014-02-19 | 北京奇虎科技有限公司 | Domain name resolution detection method, domain name resolution detection device and server |
CN104158919A (en) * | 2014-08-20 | 2014-11-19 | 安一恒通(北京)科技有限公司 | Webpage access implementation method, server and client |
Also Published As
Publication number | Publication date |
---|---|
CN105991797A (en) | 2016-10-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105991797B (en) | Method and device for mobile terminal to access network | |
CN103888358B (en) | Routing method, device, system and gateway equipment | |
US20200028892A1 (en) | Dns resolution of internal tenant-specific domain addresses in a multi-tenant computing environment | |
CN103780714B (en) | The detection method of a kind of dns server and device | |
CN114025021B (en) | Communication method, system, medium and electronic equipment crossing Kubernetes cluster | |
CN105991798A (en) | Method and device for network access by mobile terminal | |
WO2021004528A1 (en) | Method, device and apparatus for address acquisition of application example and storage medium | |
CN103281409B (en) | Based on mobile Internet domain name analytic method and the dns server of Transmission Control Protocol | |
CN107528862B (en) | Domain name resolution method and device | |
WO2019042186A1 (en) | Network management method and related device | |
CN103685590B (en) | Obtain the method and system of IP address | |
CN108322506A (en) | A kind of methods, devices and systems of internet of things equipment access network | |
US7844710B2 (en) | Proxy caching for directory services | |
US9565161B2 (en) | Automatically replacing localhost as hostname in URL with fully qualified domain name or IP address | |
CN102187636A (en) | Methods, apparatuses, and computer program products for determining a network interface to access a network resource | |
CN103581351B (en) | The method and apparatus of network access | |
CN109327559B (en) | Domain name resolution method and device based on hybrid cloud platform | |
WO2019001376A1 (en) | Nf dynamic data exposure to nrf in 5g core network | |
CN112702441B (en) | Container-based access data processing method, device, system and storage medium | |
WO2019052058A1 (en) | Domain name redirecting method and system | |
WO2020088170A1 (en) | Domain name system configuration method and related apparatus | |
CN104040538B (en) | A kind of the Internet, applications exchange method, apparatus and system | |
CN112104640A (en) | Data processing method, device and equipment of gateway and readable storage medium | |
CN105610958A (en) | A method, device and intelligent terminal for selecting a time synchronization server | |
CN105991799B (en) | Method and device for mobile terminal to access network |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right |
Effective date of registration: 20220727 Address after: Room 801, 8th floor, No. 104, floors 1-19, building 2, yard 6, Jiuxianqiao Road, Chaoyang District, Beijing 100015 Patentee after: BEIJING QIHOO TECHNOLOGY Co.,Ltd. Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park) Patentee before: BEIJING QIHOO TECHNOLOGY Co.,Ltd. Patentee before: Qizhi software (Beijing) Co.,Ltd. |
|
TR01 | Transfer of patent right |