CN106210163B - IP address-based localization method and device - Google Patents

IP address-based localization method and device Download PDF

Info

Publication number
CN106210163B
CN106210163B CN201610512659.4A CN201610512659A CN106210163B CN 106210163 B CN106210163 B CN 106210163B CN 201610512659 A CN201610512659 A CN 201610512659A CN 106210163 B CN106210163 B CN 106210163B
Authority
CN
China
Prior art keywords
address
cached
database
type
positioning result
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
Application number
CN201610512659.4A
Other languages
Chinese (zh)
Other versions
CN106210163A (en
Inventor
刘懿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201610512659.4A priority Critical patent/CN106210163B/en
Publication of CN106210163A publication Critical patent/CN106210163A/en
Application granted granted Critical
Publication of CN106210163B publication Critical patent/CN106210163B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/69Types of network addresses using geographic information, e.g. room number

Abstract

The present invention provides a kind of IP address-based localization method and device.The locating request message that the embodiment of the present invention passes through acquisition terminal, it include the IP address of the terminal in the locating request message, and then utilize at least one cached IP address database of the terminal, obtain this positioning result, make it possible to export this described positioning result, due to using cached IP address database, this positioning result of terminal is provided, to improve location efficiency.

Description

IP address-based localization method and device
[technical field]
The present invention relates to Internet technology more particularly to a kind of IP address-based localization methods and device.
[background technique]
IP is the abbreviation of English Internet Protocol, " agreement interconnected between network " is meant, in internet (Internet) in, it be can make to connect all computer networks on the net realize the set of rule being in communication with each other, it is specified that The rule that computer should abide by when being communicated on internet.Therefore, IP can also be called " Internet Protocol ".IP Location is used to one, the terminal on Internet number, and IP address has been required in the terminal of every networking, could positive normal open Letter.
In the prior art, the IP address of request end offer is provided, IP address database is inquired, obtains the IP address institute Region, for example, province, city etc., still, location efficiency is low.
[summary of the invention]
Many aspects of the invention provide a kind of IP address-based localization method and device, to improve location efficiency.
An aspect of of the present present invention provides a kind of IP address-based localization method, comprising:
The locating request message of terminal is obtained, includes the IP address of the terminal in the locating request message;
Using at least one cached IP address database of the terminal, this positioning result is obtained;
Export this described positioning result.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, it is described to utilize institute At least one the cached IP address database for stating terminal, obtains this positioning result, comprising:
If each cached IP address database is sky at least one cached IP address database of the terminal, carry out Based on the localization process of the IP address, to obtain this positioning result;By the IP address, this described positioning result and determine Position time, storage any cached IP address database at least one described cached IP address database;
If any cached IP address database is not empty at least one cached IP address database of the terminal, and institute IP address is stated in a cached IP address database at least one described cached IP address database, and the IP address Time difference of the corresponding positioning time apart from current time is less than or equal to pre-set time threshold, will be one Average positioning result corresponding to the IP address in cached IP address database, as this positioning result;
If any cached IP address database is not empty at least one cached IP address database of the terminal, and institute IP address is stated not in a cached IP address database at least one described cached IP address database, or and described IP address is in a cached IP address database at least one described cached IP address database, and IP address institute Time difference of the corresponding positioning time apart from current time is greater than the time threshold, carries out the positioning based on the IP address Processing, to obtain this positioning result;By the IP address, this described positioning result and the positioning time, institute is arrived in storage State a cached IP address database at least one cached IP address database.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, it is described will be described IP address, this described positioning result and the positioning time store at least one described cached IP address database One cached IP address database, comprising:
It is put down according to corresponding to IP address described in this described positioning result and each cached IP address database Equal positioning result obtains caching IP belonging to the smallest average positioning result of spacing distance between this described positioning result Address database;
If the IP address is in the cached IP address database belonging to the smallest average positioning result of the spacing distance, Or the spacing distance is less than or equal to pre-set distance threshold, utilizes the IP address, this described positioning result With the positioning time, cached IP address database belonging to the smallest average positioning result of the spacing distance is updated;
If the IP address is not in the smallest cached IP address database belonging to positioning result that is averaged of the spacing distance In, and the spacing distance is greater than the distance threshold,
If any cached IP address database is sky at least one described cached IP address database, by the IP Any cached IP address database is arrived in location, this described positioning result and positioning time, storage;
If each cached IP address database described at least one described cached IP address database is not sky, empty The cached IP address database of renewal time earliest deposits the IP address, this described positioning result and positioning time Store up the cached IP address database after emptying.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, described at least one The quantity of a cached IP address database is 2.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, the carry out base In the localization process of the IP address, comprising:
Obtain the IP address type of the IP address;
According to the IP address type of the IP address, position data corresponding to the IP address is obtained, using as described This positioning result.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, the IP address IP address type include the first kind, Second Type, third type or the 4th type;Wherein,
The first kind is fixed allocation single centre vertex type;
The Second Type is to dynamically distribute single centre vertex type;
The third type is fixed allocation multicenter vertex type;
4th type is to dynamically distribute multicenter vertex type.
Another aspect of the present invention provides a kind of IP address-based positioning device, comprising:
Acquiring unit includes the terminal in the locating request message for obtaining the locating request message of terminal IP address;
Positioning unit obtains this positioning result at least one cached IP address database using the terminal;
Output unit, for exporting this described positioning result.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, the positioning are single Member is specifically used for
If each cached IP address database is sky at least one cached IP address database of the terminal, carry out Based on the localization process of the IP address, to obtain this positioning result;By the IP address, this described positioning result and determine Position time, storage any cached IP address database at least one described cached IP address database;
If any cached IP address database is not empty at least one cached IP address database of the terminal, and institute IP address is stated in a cached IP address database at least one described cached IP address database, and the IP address Time difference of the corresponding positioning time apart from current time is less than or equal to pre-set time threshold, will be one Average positioning result corresponding to the IP address in cached IP address database, as this positioning result;
If any cached IP address database is not empty at least one cached IP address database of the terminal, and institute IP address is stated not in a cached IP address database at least one described cached IP address database, or and described IP address is in a cached IP address database at least one described cached IP address database, and IP address institute Time difference of the corresponding positioning time apart from current time is greater than the time threshold, carries out the positioning based on the IP address Processing, to obtain this positioning result;By the IP address, this described positioning result and the positioning time, institute is arrived in storage State a cached IP address database at least one cached IP address database.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, the positioning are single Member is specifically used for
It is put down according to corresponding to IP address described in this described positioning result and each cached IP address database Equal positioning result obtains caching IP belonging to the smallest average positioning result of spacing distance between this described positioning result Address database;
If the IP address is in the cached IP address database belonging to the smallest average positioning result of the spacing distance, Or the spacing distance is less than or equal to pre-set distance threshold, utilizes the IP address, this described positioning result With the positioning time, cached IP address database belonging to the smallest average positioning result of the spacing distance is updated;
If the IP address is not in the smallest cached IP address database belonging to positioning result that is averaged of the spacing distance In, and the spacing distance is greater than the distance threshold,
If any cached IP address database is sky at least one described cached IP address database, by the IP Any cached IP address database is arrived in location, this described positioning result and positioning time, storage;
If each cached IP address database described at least one described cached IP address database is not sky, empty The cached IP address database of renewal time earliest deposits the IP address, this described positioning result and positioning time Store up the cached IP address database after emptying.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, described at least one The quantity of a cached IP address database is 2.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, the positioning are single Member is specifically used for
Obtain the IP address type of the IP address;
According to the IP address type of the IP address, position data corresponding to the IP address is obtained, using as described This positioning result.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, the IP address IP address type include the first kind, Second Type, third type or the 4th type;Wherein,
The first kind is fixed allocation single centre vertex type;
The Second Type is to dynamically distribute single centre vertex type;
The third type is fixed allocation multicenter vertex type;
4th type is to dynamically distribute multicenter vertex type.
As shown from the above technical solution, the embodiment of the present invention passes through the locating request message for obtaining terminal, and the positioning is asked The IP address in message comprising the terminal is sought, and then using at least one cached IP address database of the terminal, is obtained This positioning result makes it possible to export this described positioning result due to using cached IP address database and provides terminal This positioning result, to improve location efficiency.
In addition, using technical solution provided by the present invention, at least one cached IP address database of the terminal When can not provide this positioning result of terminal, by obtaining the IP address type of IP address to be positioned, and then according to described The IP address type of IP address, obtains position data corresponding to the IP address, using this positioning result as terminal, by In different types of IP address, feature is had different distributions, therefore, according to the address style of the IP address identified, is held The IP address-based positioning operation of row, can obtain accurate position data, to improve the positioning based on IP address positioning Precision.
In addition, the experience of user can be effectively improved using technical solution provided by the present invention.
[Detailed description of the invention]
It to describe the technical solutions in the embodiments of the present invention more clearly, below will be to embodiment or description of the prior art Needed in attached drawing be briefly described, it should be apparent that, the accompanying drawings in the following description is some realities of the invention Example is applied, it for those of ordinary skill in the art, without any creative labor, can also be attached according to these Figure obtains other attached drawings.
Fig. 1 is the flow diagram for the IP address-based localization method that one embodiment of the invention provides;
Fig. 2 be another embodiment of the present invention provides IP address-based positioning device structural schematic diagram.
[specific embodiment]
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art Whole other embodiments obtained without creative efforts, shall fall within the protection scope of the present invention.
It should be noted that terminal involved in the embodiment of the present invention can include but is not limited to mobile phone, individual digital Assistant (Personal Digital Assistant, PDA), radio hand-held equipment, tablet computer (Tablet Computer), PC (Personal Computer, PC), MP3 player, MP4 player, wearable device (for example, intelligent glasses, Smartwatch, Intelligent bracelet etc.) etc..
In addition, the terms "and/or", only a kind of incidence relation for describing affiliated partner, indicates may exist Three kinds of relationships, for example, A and/or B, can indicate: individualism A exists simultaneously A and B, these three situations of individualism B.Separately Outside, character "/" herein typicallys represent the relationship that forward-backward correlation object is a kind of "or".
Fig. 1 is the flow diagram for the IP address-based localization method that one embodiment of the invention provides, as shown in Figure 1.
101, the locating request message of terminal is obtained, includes the IP address of the terminal in the locating request message.
102, using at least one cached IP address database of the terminal, this positioning result is obtained.
103, this described positioning result is exported.
It should be noted that some or all of 101~103 executing subject can be to be located locally the application of terminal, It or can also be the plug-in unit or Software Development Kit (Software being arranged in the application of local terminal Development Kit, SDK) etc. functional units, perhaps can also in network side server processing engine or It can also be for positioned at the distributed system of network side, the present embodiment be to this without being particularly limited to.
It is understood that the application can be mounted in the local program (nativeApp) in terminal, or may be used also To be a web page program (webApp) of browser in terminal, the present embodiment is to this without being particularly limited to.
In this way, pass through the locating request message for obtaining terminal, the IP in the locating request message comprising the terminal Location, and then using at least one cached IP address database of the terminal, this positioning result is obtained, makes it possible to export institute This positioning result is stated, due to using cached IP address database, this positioning result of terminal is provided, to improve positioning Efficiency.
In the present invention, it is contemplated that the IP address of each user institute using terminal is limited quantity, and each user is daily There is fixed stop place, for example, family, company etc. in life.Therefore, the slow of corresponding each stop place can be respectively set IP address database is deposited, the cached IP address database as terminal.Wherein, in each cached IP address database, Ke Yicun Contain the IP address and renewal time of a stop place and several terminals.It is slow can also to be known as this for this stop place The central point of IP address database is deposited, it is according to each IP address in the cached IP address database based on any positioning Technology positioning result obtained, one calculated are averaged positioning result.
Preferably, in a possible implementation of the present embodiment, the cached IP address database of terminal, quantity It can be 2, i.e. the stop place stored in a cached IP address database is the family position of the user of using terminal, The stop place stored in another cached IP address database is the company position of the user of using terminal.
Optionally, in a possible implementation of the present embodiment, in 102, it specifically may determine that the terminal At least one cached IP address database in each cached IP address database whether be sky.
During another concrete implementation, if each delaying at least one cached IP address database of the terminal Depositing IP address database is sky, then can carry out the localization process based on the IP address, to obtain this positioning result;So Afterwards, then the IP address, this described positioning result and positioning time can be stored at least one described cached IP address Any cached IP address database in database.
During another concrete implementation, if each delaying at least one cached IP address database of the terminal Depositing IP address database not to be is sky, that is to say, that any slow at least one cached IP address database of the terminal Deposit IP address database not and be empty, an and caching IP of the IP address at least one described cached IP address database In address database, and time difference of the positioning time corresponding to the IP address apart from current time is less than or equal in advance The time threshold of setting, then can be by average positioning corresponding to the IP address in one cached IP address database It as a result is the central point of one cached IP address database, as this positioning result.
During another concrete implementation, if each delaying at least one cached IP address database of the terminal Depositing IP address database not to be is sky, that is to say, that any slow at least one cached IP address database of the terminal Deposit IP address database not and be empty, an and caching of the IP address not at least one described cached IP address database In IP address database, then the localization process based on the IP address can be carried out, to obtain this positioning result;If the end End at least one cached IP address database in each cached IP address database be not be sky, that is to say, that the end Any cached IP address database is not empty at least one cached IP address database at end, and the IP address it is described extremely In a cached IP address database in a few cached IP address database, and positioning time corresponding to the IP address Time difference apart from current time is greater than the time threshold, then can carry out the localization process based on the IP address, with Obtain this positioning result.
During the realization, after obtaining this positioning result, then the IP address, this described positioning can be tied Fruit and the positioning time, storage to a cached IP address database at least one described cached IP address database.
It specifically, specifically can be according to this described positioning result and each cached IP address database Average positioning result corresponding to IP address obtains the smallest average positioning of spacing distance between this described positioning result As a result the cached IP address database belonging to.
For example, if IP address cached IP address data belonging to the smallest average positioning result of the spacing distance In library or the spacing distance is less than or equal to pre-set distance threshold, then can use the IP address, described Secondary positioning result and the positioning time update cached IP address number belonging to the smallest average positioning result of the spacing distance According to library.It is so-called to update cached IP address database belonging to the smallest average positioning result of the spacing distance, refer to basis Average positioning result in this described positioning result and the cached IP address database, obtains new average positioning result.Tool Different weights can be respectively set from the average positioning result to this described positioning result in body way, be weighted fortune It calculates, to obtain new be averaged.
Alternatively, for another example if the IP address is not in the smallest caching belonging to positioning result that is averaged of the spacing distance In IP address database, and the spacing distance be greater than the distance threshold, it is also necessary to further judge it is described at least one In cached IP address database, there is any cached IP address database for empty or described each cached IP address database It is not sky.
It, can will be described if any cached IP address database is sky at least one described cached IP address database Any cached IP address database is arrived in IP address, this described positioning result and positioning time, storage.
If each cached IP address database described at least one described cached IP address database is not sky, can To empty the cached IP address database of renewal time earliest, by the IP address, this described positioning result and positioning Time stores the cached IP address database to after emptying.
In the present invention, performed carries out the localization process based on the IP address, specifically can be using in the prior art Any technical solution, carry out the localization process based on the IP address.
It is for instance possible to obtain the IP address type of the IP address in turn then can be according to the IP address of the IP address Type obtains position data corresponding to the IP address, using as this described positioning result.In this way, in the terminal When at least one cached IP address database can not provide this positioning result of terminal, by obtaining IP address to be positioned IP address type, and then according to the IP address type of the IP address, position data corresponding to the IP address is obtained, to make Feature is had different distributions due to different types of IP address for this positioning result of terminal, therefore, according to being identified The address style of IP address out executes IP address-based positioning operation, can obtain accurate position data, to improve Positioning accuracy based on IP address positioning.
Specifically, the IP address type of the IP address can include but is not limited to the first kind, Second Type, Three types or the 4th type, the present embodiment is to this without being particularly limited to.
For example, the first kind is fixed allocation single centre vertex type;The Second Type is to dynamically distribute list Center vertex type;The third type is fixed allocation multicenter vertex type;4th type is to dynamically distribute multicenter point Type.
So-called fixed allocation single centre vertex type, such IP address show distribution and concentrate on a region The fixed ip address that terminal is distributed.For example, some school district of school, company the places such as some office block terminal.
So-called dynamic allocation single centre vertex type, such IP address refer at the appointed time within the scope of to point Cloth concentrates on the free IP addresses that the terminal in a region is distributed.For example, the terminal of cell.
So-called fixed allocation multicenter vertex type, such IP address show distribution and concentrate on multiple regions The region of the fixed ip address that terminal is distributed, distribution is less, is usually no more than 6.For example, whole school districts of school, public affairs The terminal in the places such as whole office blocks of department.
So-called dynamic allocation multicenter vertex type, such IP address refer at the appointed time within the scope of to point Cloth concentrates on the free IP addresses that the terminal of multiple regions is distributed, and the region of distribution is more, and generally at least 6.For example, The terminal of many cells.
It, can also be further fixed previously according to a large amount of history of terminal before the IP address type for obtaining the IP address Position data, analyze IP address type corresponding to each IP address, for being wrapped according in the received locating request message of institute The IP address of the terminal contained obtains the IP address type of the IP address.
Specifically, for the IP address, at least one history of the available terminal with the IP address is positioned Data include network connection instruction at least one described historical location data in each historical location data.If described each Network connection included in historical location data indicates that equal instruction terminal online is connected as Wireless Fidelity (Wireless Fidelity, Wi-Fi) it is connected to the network, at least one historical location data by described in, the collection point as the IP address is adopted Collect point data.In turn, then can according to the acquisition point data of the collection point of the IP address, to the collection point of the IP address, The Density Clustering processing based on distance is carried out, to obtain at least one apart from cluster.It is then possible to according at least one described distance The distributed data of cluster obtains the IP address type of the IP address.
In the present invention, acquired historical location data, can be for using the positioning of any positioning method acquisition terminal As a result relative recording data, for example, global positioning system (Global Positioning System, GPS) positioning method, Wi-Fi positioning or base station location etc..Specifically, the historical location data of any terminal can include but is not limited to the IP of terminal Address, positioning time, positioning result and network connection instruction, the present embodiment is to this without being particularly limited to.Wherein, described Network connection instruction, can serve to indicate that terminal online connection whether be Wi-Fi network connection, for example, network access style mark or Whether connection Wi-Fi network instruction etc. is had.
During a concrete implementation, the historical location data of whole terminals can be specifically acquired, it in turn, then can be with IP address is specified using identical IP address as several, at least one the described history for obtaining the terminal with the IP address is fixed Position data.
It is described to be obtained in the following way apart from cluster: according to the IP during another concrete implementation Positioning result, that is, collection point geographic position data in the acquisition point data of the collection point of location, the acquisition to the IP address Point carries out the Density Clustering processing based on distance, with distance threshold to obtain at least one apart from cluster.
Wherein, the distance threshold, can be pre-set empirical value, or can according to the IP address The geographic position data of collection point, which calculates, to be obtained, and the present embodiment is to this without being particularly limited to.
During another concrete implementation, obtain it is described at least one after cluster, specifically can be according to institute The quantity apart from cluster, the distribution equal distribution data obtained, obtain the IP address type of the IP address.
For example, the IP address type of the IP address is the first kind if acquisition one is described apart from cluster.
Alternatively, for another example if obtain it is at least two described apart from cluster, and it is described at least two it is described in cluster each away from It is in time ordered arrangement from cluster, then the IP address type of the IP address is Second Type.
Alternatively, for another example if obtain it is at least two described apart from cluster, and it is described at least two it is described in cluster each away from It is in time disorderly arranged from cluster, and the quantity apart from cluster is less than or equal to pre-set amount threshold, then it is described The IP address type of IP address is third type.
Alternatively, for another example if obtain it is at least two described apart from cluster, and it is described at least two it is described in cluster each away from It is in time disorderly arranged from cluster, and the quantity apart from cluster is greater than pre-set amount threshold, the then IP address IP address type be Second Type or the 4th type.It specifically, in instances, specifically can adopting according to the IP address The acquisition point data of collection point, with time threshold, carries out time-based Density Clustering processing to the collection point of the IP address, To obtain at least one Temporal Clustering.In turn, then can according to the acquisition point data of the collection point of the IP address, to it is described at least Collection point in one Temporal Clustering in each Temporal Clustering carries out the Density Clustering processing based on distance, when obtaining described each Between at least one son in cluster apart from cluster.If obtaining the son in any time cluster apart from cluster, in any time The IP address type of the IP address is the first kind in cluster;If obtaining at least two sons in any time cluster apart from cluster, And at least two son height every in cluster is ordered arrangement apart from cluster in time, then in any time cluster The IP address type of the interior IP address is Second Type;If at least two sons are obtained in any time cluster apart from cluster, and At least two son height every in cluster is disorderly arranged, and quantity of the son apart from cluster apart from cluster in time Less than or equal to pre-set amount threshold, then the IP address type of the IP address is third in any time cluster Type.So, if the IP address type of the IP address is the first kind or described second in each Temporal Clustering Type, then the IP address type of the IP address is Second Type;If the IP of the IP address in any time cluster Location type is third type, then the IP address type of the IP address is the 4th type.
Time-based Density Clustering processing is being carried out, can also further obtained at the time-based Density Clustering The time threshold of reason.For example, the positioning time of each collection point of the available IP address in turn then can be according to institute The positioning time for stating each collection point of IP address obtains collection point transfer time such as the average value of the IP address, will be described Collection point transfer time, the time threshold as the time-based Density Clustering processing.
In this way, by obtain have IP address terminal at least one historical location data, if it is described at least one go through Network connection included in each each historical location data of historical location data indicates equal instruction terminal in history location data Online is connected as Wi-Fi network connection, then can be by least one described historical location data, the acquisition as the IP address The acquisition point data of point, and then the IP address is adopted by the acquisition point data according to the collection point of the IP address again Collect point, carry out the Density Clustering processing based on distance, to obtain at least one apart from cluster, makes it possible at least one described in basis Distributed data apart from cluster obtains the IP address type of the IP address, due to use magnanimity historical location data this Big data is positioned, so that the identification of IP address is more accurate, to improve the reliability of IP address classification.
After analyzing IP address type corresponding to each IP address, can will each IP address and its corresponding to IP address type carries out storage processing in the storage equipment of terminal.
During a concrete implementation, the storage equipment of the terminal can be slow storage device, specifically can be with It for the hard disk of computer system, or can also be inoperative memory, that is, physical memory of mobile phone, for example, read-only memory (Read-Only Memory, ROM) and RAM card etc., the present embodiment is to this without being particularly limited to.
During another concrete implementation, the storage equipment of the terminal can also be speedy storage equipment, specifically It can be the memory of computer system, or can also be running memory, that is, Installed System Memory of mobile phone, for example, random access memory (Random Access Memory, RAM) etc., the present embodiment is to this without being particularly limited to.
It, can also be further previously according to end in the positioning process based on the IP address that the present invention is carried out A large amount of historical location datas at end, excavate position data corresponding to each IP address, for carrying out based on the IP address Localization process obtained corresponding to the IP address that is, according to IP address to be positioned and the IP address type of the IP address Position data, i.e., the position data of the described terminal.
Specifically, for the IP address, the IP address can be obtained according to the IP address type of the IP address The collection point time-to-live.In turn, then the collection point of the collection point within the collection point time-to-live of the available IP address Data.It is then possible to according to the collection point time-to-live of the IP address type of the IP address and the acquired IP address Within collection point acquisition point data, obtain position data corresponding to the IP address.
If the IP address type of the IP address is the first kind or third type, when the collection point of the IP address is survived Between can be the endless time;If the IP address type of the IP address be Second Type or the 4th type, the IP address The collection point time-to-live can be for acquisition by the following method: when the positioning of each collection point of the available IP address Between, in turn, then the collection point transfer of the IP address according to the positioning time of each collection point of the IP address, can be obtained Time such as average value, by the collection point transfer time, the collection point time-to-live of the IP address.
For example, if the IP address type of the IP address is the first kind, the collection point of the acquired IP address The acquisition point data of collection point within time-to-live, calculates the position data of a center, using as the IP address Corresponding position data.
Alternatively, for another example if the IP address type of the IP address is Second Type or third type or the 4th type, According to the acquisition point data of the collection point within the collection point time-to-live of the acquired IP address, to the collection point, The Density Clustering processing based on distance is carried out, to obtain at least two apart from cluster;If described at least two is described every in cluster A apart from cluster be ordered arrangement in time, calculates the position of the positioning time center apart from cluster nearest apart from current time Data are set, using as position data corresponding to the IP address;If described at least two is described each apart from cluster in cluster It is in time disorderly arranged, the positional number of calculating at least two center apart from cluster each in cluster According to using as position data corresponding to the IP address.
It, can be by the position corresponding to each IP address and its after excavating position data corresponding to each IP address Data are set, carry out storage processing in the storage equipment of terminal.
During a concrete implementation, the storage equipment of the terminal can be slow storage device, specifically can be with It for the hard disk of computer system, or can also be inoperative memory, that is, physical memory of mobile phone, for example, read-only memory (Read-Only Memory, ROM) and RAM card etc., the present embodiment is to this without being particularly limited to.
During another concrete implementation, the storage equipment of the terminal can also be speedy storage equipment, specifically It can be the memory of computer system, or can also be running memory, that is, Installed System Memory of mobile phone, for example, random access memory (Random Access Memory, RAM) etc., the present embodiment is to this without being particularly limited to.
It, specifically can be according to the IP address in the positioning process based on the IP address that the present invention is carried out IP address type, directly obtain position data corresponding to the IP address;Or the stop place of the terminal is obtained, Near the stop place of the terminal, position data corresponding to the IP address is obtained.
It is understood that if current time not within the collection point time-to-live of the IP address, directly tie Line journey, positioning failure.Only current time within the collection point time-to-live of the IP address, after being just normally carried out Continuous positioning operation.
During a concrete implementation, if the IP address type of the IP address is the first kind, directly obtain Position data corresponding to the IP address, the positioning result as terminal.
During another concrete implementation, if the IP address type of the IP address is Second Type, directly obtain Obtain position data corresponding to the IP address, the positioning result as terminal.
During another concrete implementation, if the IP address type of the IP address is third type or the 4th class Type then can further obtain the stop place of the terminal, near the stop place of the terminal, obtain the IP address Corresponding position data.
It is understood that obtaining the stop place of terminal, any method in the prior art can be used, for example, can With according to contact address of the user in the registration information provided in specified application perhaps the information acquisitions such as work unit or Can also be obtained according to the historical location data of user, etc., the present embodiment is to this without being particularly limited to.
It include the terminal in the locating request message by obtaining the locating request message of terminal in the present embodiment IP address, and then using the terminal at least one cached IP address database, obtain this positioning result, make it possible to It exports this described positioning result and this positioning result of terminal is provided, to improve due to using cached IP address database Location efficiency.
In addition, using technical solution provided by the present invention, at least one cached IP address database of the terminal When can not provide this positioning result of terminal, by obtaining the IP address type of IP address to be positioned, and then according to described The IP address type of IP address, obtains position data corresponding to the IP address, using this positioning result as terminal, by In different types of IP address, feature is had different distributions, therefore, according to the address style of the IP address identified, is held The IP address-based positioning operation of row, can obtain accurate position data, to improve the positioning based on IP address positioning Precision.
In addition, the experience of user can be effectively improved using technical solution provided by the present invention.
It should be noted that for the various method embodiments described above, for simple description, therefore, it is stated as a series of Combination of actions, but those skilled in the art should understand that, the present invention is not limited by the sequence of acts described because According to the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know It knows, the embodiments described in the specification are all preferred embodiments, and related actions and modules is not necessarily of the invention It is necessary.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, there is no the portion being described in detail in some embodiment Point, reference can be made to the related descriptions of other embodiments.
Fig. 2 be another embodiment of the present invention provides IP address-based positioning device structural schematic diagram, such as Fig. 2 institute Show.The IP address-based positioning device of the present embodiment may include acquiring unit 21, positioning unit 22 and output unit 23.Its In, acquiring unit 21, for obtaining the locating request message of terminal, IP in the locating request message comprising the terminal Location;Positioning unit 22 obtains this positioning result at least one cached IP address database using the terminal;It is defeated Unit 23 out, for exporting this described positioning result.
It should be noted that some or all of IP address-based positioning device provided by the present embodiment can be position Application in local terminal, or can also be the plug-in unit being arranged in the application of local terminal or Software Development Kit Functional units such as (Software Development Kit, SDK), or can also be the processing in network side server Engine, or can also be for positioned at the distributed system of network side, the present embodiment is to this without being particularly limited to.
It is understood that the application can be mounted in the local program (nativeApp) in terminal, or may be used also To be a web page program (webApp) of browser in terminal, the present embodiment is to this without being particularly limited to.
Optionally, in a possible implementation of the present embodiment, the positioning unit 22 specifically can be used for
If each cached IP address database is sky at least one cached IP address database of the terminal, carry out Based on the localization process of the IP address, to obtain this positioning result;By the IP address, this described positioning result and determine Position time, storage any cached IP address database at least one described cached IP address database;
If any cached IP address database is not empty at least one cached IP address database of the terminal, and institute IP address is stated in a cached IP address database at least one described cached IP address database, and the IP address Time difference of the corresponding positioning time apart from current time is less than or equal to pre-set time threshold, will be one Average positioning result corresponding to the IP address in cached IP address database, as this positioning result;
If any cached IP address database is not empty at least one cached IP address database of the terminal, and institute IP address is stated not in a cached IP address database at least one described cached IP address database, or and described IP address is in a cached IP address database at least one described cached IP address database, and IP address institute Time difference of the corresponding positioning time apart from current time is greater than the time threshold, carries out the positioning based on the IP address Processing, to obtain this positioning result;By the IP address, this described positioning result and the positioning time, institute is arrived in storage State a cached IP address database at least one cached IP address database.
Optionally, in a possible implementation of the present embodiment, the positioning unit 22 specifically can be used for
It is put down according to corresponding to IP address described in this described positioning result and each cached IP address database Equal positioning result obtains caching IP belonging to the smallest average positioning result of spacing distance between this described positioning result Address database;
If the IP address is in the cached IP address database belonging to the smallest average positioning result of the spacing distance, Or the spacing distance is less than or equal to pre-set distance threshold, utilizes the IP address, this described positioning result With the positioning time, cached IP address database belonging to the smallest average positioning result of the spacing distance is updated;
If the IP address is not in the smallest cached IP address database belonging to positioning result that is averaged of the spacing distance In, and the spacing distance is greater than the distance threshold,
If any cached IP address database is sky at least one described cached IP address database, by the IP Any cached IP address database is arrived in location, this described positioning result and positioning time, storage;
If each cached IP address database described at least one described cached IP address database is not sky, empty The cached IP address database of renewal time earliest deposits the IP address, this described positioning result and positioning time Store up the cached IP address database after emptying.
Optionally, in a possible implementation of the present embodiment, at least one described cached IP address database Quantity can be 2.
Optionally, in a possible implementation of the present embodiment, the positioning unit 22 specifically can be used for
Obtain the IP address type of the IP address;And
According to the IP address type of the IP address, position data corresponding to the IP address is obtained, using as described This positioning result.
Specifically, the IP address type of the IP address can include but is not limited to the first kind, Second Type, Three types or the 4th type, the present embodiment is to this without being particularly limited to.
For example, the first kind is fixed allocation single centre vertex type;The Second Type is to dynamically distribute list Center vertex type;The third type is fixed allocation multicenter vertex type;4th type is to dynamically distribute multicenter point Type.
It should be noted that method in the corresponding embodiment of Fig. 1, it can be by provided in this embodiment IP address-based fixed Position device is realized.Detailed description may refer to the related content in the corresponding embodiment of Fig. 1, and details are not described herein again.
In the present embodiment, the locating request message of terminal is obtained by acquiring unit, includes in the locating request message The IP address of the terminal, and then this is obtained using at least one cached IP address database of the terminal by positioning unit Secondary positioning result enables output unit to export this described positioning result and provides due to using cached IP address database This positioning result of terminal, to improve location efficiency.
In addition, using technical solution provided by the present invention, at least one cached IP address database of the terminal When can not provide this positioning result of terminal, by obtaining the IP address type of IP address to be positioned, and then according to described The IP address type of IP address, obtains position data corresponding to the IP address, using this positioning result as terminal, by In different types of IP address, feature is had different distributions, therefore, according to the address style of the IP address identified, is held The IP address-based positioning operation of row, can obtain accurate position data, to improve the positioning based on IP address positioning Precision.
In addition, the experience of user can be effectively improved using technical solution provided by the present invention.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description, The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In several embodiments provided by the present invention, it should be understood that disclosed system, device and method can be with It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unit It divides, only a kind of logical function partition, there may be another division manner in actual implementation, for example, multiple units or group Part can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown Or the mutual coupling, direct-coupling or communication connection discussed can be through some interfaces, device or unit it is indirect Coupling or communication connection can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme 's.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list Member both can take the form of hardware realization, can also realize in the form of hardware adds SFU software functional unit.
The above-mentioned integrated unit being realized in the form of SFU software functional unit can store and computer-readable deposit at one In storage media.Above-mentioned SFU software functional unit is stored in a storage medium, including some instructions are used so that a computer It is each that device (can be personal computer, server or network equipment etc.) or processor (processor) execute the present invention The part steps of embodiment the method.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (Read- Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic or disk etc. it is various It can store the medium of program code.
Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although Present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: it still may be used To modify the technical solutions described in the foregoing embodiments or equivalent replacement of some of the technical features; And these are modified or replaceed, technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution spirit and Range.

Claims (8)

1. a kind of IP address-based localization method characterized by comprising
The locating request message of terminal is obtained, includes the IP address of the terminal in the locating request message;
Using at least one cached IP address database of the terminal, this positioning result is obtained;
Export this described positioning result;It is wherein, described to carry out the localization process based on the IP address, comprising:
Obtain the IP address type of the IP address;And
According to the IP address type of the IP address, obtain position data corresponding to the IP address, using as it is described this Positioning result;Wherein,
The IP address type of the IP address includes the first kind, Second Type, third type or the 4th type;Wherein,
The first kind is fixed allocation single centre vertex type, and the IP address of the type is to show distribution to concentrate on a region The fixed ip address that is distributed of terminal;
The Second Type be dynamically distribute single centre vertex type, the IP address of the type refer at the appointed time within the scope of to Distribution concentrates on the free IP addresses that the terminal in a region is distributed;
The third type is fixed allocation multicenter vertex type, and the IP address of the type is to show distribution to concentrate on multiple regions The fixed ip address that is distributed of terminal;
4th type be dynamically distribute multicenter vertex type, the IP address of the type refer at the appointed time within the scope of to Distribution concentrates on the free IP addresses that the terminal of multiple regions is distributed.
2. the method according to claim 1, wherein described at least one cached IP address using the terminal Database obtains this positioning result, comprising:
If each cached IP address database is sky at least one cached IP address database of the terminal, it is based on The localization process of the IP address, to obtain this positioning result;When by the IP address, this described positioning result and positioning Between, storage any cached IP address database at least one described cached IP address database;
If any cached IP address database is not empty at least one cached IP address database of the terminal, and the IP Address is in a cached IP address database at least one described cached IP address database, and IP address institute is right Time difference of the positioning time answered apart from current time is less than or equal to pre-set time threshold, by one caching Average positioning result corresponding to the IP address in IP address database, as this positioning result;
If any cached IP address database is not empty at least one cached IP address database of the terminal, and the IP Address is not in a cached IP address database at least one described cached IP address database, or and the IP Location is in a cached IP address database at least one described cached IP address database, and corresponding to the IP address Time difference of the positioning time apart from current time be greater than the time threshold, carry out at the positioning based on the IP address Reason, to obtain this positioning result;By the IP address, this described positioning result and the positioning time, storage is described in A cached IP address database at least one cached IP address database.
3. according to the method described in claim 2, it is characterized in that, it is described by the IP address, this described positioning result and The positioning time, storage to a cached IP address database at least one described cached IP address database, comprising:
It is average fixed according to corresponding to IP address described in this described positioning result and each cached IP address database Position is as a result, obtain cached IP address belonging to the smallest average positioning result of spacing distance between this described positioning result Database;
If the IP address is in the cached IP address database belonging to the smallest average positioning result of the spacing distance, or The spacing distance is less than or equal to pre-set distance threshold, utilizes the IP address, this described positioning result and institute Positioning time is stated, cached IP address database belonging to the smallest average positioning result of the spacing distance is updated;
If the IP address is in the cached IP address database belonging to the smallest average positioning result of the spacing distance, and The spacing distance is greater than the distance threshold,
If any cached IP address database is sky at least one described cached IP address database, by the IP address, institute This positioning result and positioning time are stated, any cached IP address database is arrived in storage;
If each cached IP address database described at least one described cached IP address database is not sky, update is emptied The cached IP address database of time earliest, the IP address, this described positioning result and positioning time, storage are arrived Cached IP address database after emptying.
4. the method according to claim 1, wherein the quantity of at least one cached IP address database is 2。
5. a kind of IP address-based positioning device characterized by comprising
Acquiring unit, for obtaining the locating request message of terminal, IP in the locating request message comprising the terminal Location;
Positioning unit obtains this positioning result at least one cached IP address database using the terminal;
Output unit, for exporting this described positioning result;Wherein,
The positioning unit, is specifically used for
Obtain the IP address type of the IP address;And
According to the IP address type of the IP address, obtain position data corresponding to the IP address, using as it is described this Positioning result;Wherein,
The IP address type of the IP address includes the first kind, Second Type, third type or the 4th type;Wherein,
The first kind is fixed allocation single centre vertex type, and the IP address of the type is to show distribution to concentrate on a region The fixed ip address that is distributed of terminal;
The Second Type be dynamically distribute single centre vertex type, the IP address of the type refer at the appointed time within the scope of to Distribution concentrates on the free IP addresses that the terminal in a region is distributed;
The third type is fixed allocation multicenter vertex type, and the IP address of the type is to show distribution to concentrate on multiple regions The fixed ip address that is distributed of terminal;
4th type be dynamically distribute multicenter vertex type, the IP address of the type refer at the appointed time within the scope of to Distribution concentrates on the free IP addresses that the terminal of multiple regions is distributed.
6. device according to claim 5, which is characterized in that the positioning unit is specifically used for
If each cached IP address database is sky at least one cached IP address database of the terminal, it is based on The localization process of the IP address, to obtain this positioning result;When by the IP address, this described positioning result and positioning Between, storage any cached IP address database at least one described cached IP address database;
If any cached IP address database is not empty at least one cached IP address database of the terminal, and the IP Address is in a cached IP address database at least one described cached IP address database, and IP address institute is right Time difference of the positioning time answered apart from current time is less than or equal to pre-set time threshold, by one caching Average positioning result corresponding to the IP address in IP address database, as this positioning result;
If any cached IP address database is not empty at least one cached IP address database of the terminal, and the IP Address is not in a cached IP address database at least one described cached IP address database, or and the IP Location is in a cached IP address database at least one described cached IP address database, and corresponding to the IP address Time difference of the positioning time apart from current time be greater than the time threshold, carry out at the positioning based on the IP address Reason, to obtain this positioning result;By the IP address, this described positioning result and the positioning time, storage is described in A cached IP address database at least one cached IP address database.
7. device according to claim 6, which is characterized in that the positioning unit is specifically used for being determined according to described this Average positioning result corresponding to IP address described in position result and each cached IP address database obtains and described Cached IP address database belonging to the smallest average positioning result of spacing distance between secondary positioning result;
If the IP address is in the cached IP address database belonging to the smallest average positioning result of the spacing distance, or The spacing distance is less than or equal to pre-set distance threshold, utilizes the IP address, this described positioning result and institute Positioning time is stated, cached IP address database belonging to the smallest average positioning result of the spacing distance is updated;
If the IP address is in the cached IP address database belonging to the smallest average positioning result of the spacing distance, and The spacing distance is greater than the distance threshold,
If any cached IP address database is sky at least one described cached IP address database, by the IP address, institute This positioning result and positioning time are stated, any cached IP address database is arrived in storage;
If each cached IP address database described at least one described cached IP address database is not sky, update is emptied The cached IP address database of time earliest, the IP address, this described positioning result and positioning time, storage are arrived Cached IP address database after emptying.
8. device according to claim 5, which is characterized in that the quantity of at least one cached IP address database is 2。
CN201610512659.4A 2016-06-30 2016-06-30 IP address-based localization method and device Active CN106210163B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610512659.4A CN106210163B (en) 2016-06-30 2016-06-30 IP address-based localization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610512659.4A CN106210163B (en) 2016-06-30 2016-06-30 IP address-based localization method and device

Publications (2)

Publication Number Publication Date
CN106210163A CN106210163A (en) 2016-12-07
CN106210163B true CN106210163B (en) 2019-08-27

Family

ID=57464015

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610512659.4A Active CN106210163B (en) 2016-06-30 2016-06-30 IP address-based localization method and device

Country Status (1)

Country Link
CN (1) CN106210163B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108282508B (en) * 2017-01-06 2021-08-03 阿里巴巴集团控股有限公司 Geographic position determining method and device and information pushing method and device
CN106998264B (en) * 2017-02-21 2019-11-26 中国科学院信息工程研究所 A kind of IP location database credibility evaluation method based on dynamic trust model
CN107613034A (en) * 2017-08-21 2018-01-19 郑州埃文计算机科技有限公司 A kind of method that house IP is navigated to residential quarters
CN107613043A (en) * 2017-09-26 2018-01-19 小草数语(北京)科技有限公司 The regional information searching method and its device of IP address
CN110138889A (en) * 2019-04-30 2019-08-16 广州微算互联信息技术有限公司 A kind of cloud mobile phone positioning method, system, device and storage medium
CN112153091B (en) * 2019-06-27 2022-05-13 北京百度网讯科技有限公司 Method and device for determining relevance of equipment
CN111104598B (en) * 2019-12-19 2023-12-22 上海秒针网络科技有限公司 Method and device for directionally pushing information, electronic equipment and readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103686698A (en) * 2013-11-13 2014-03-26 百度在线网络技术(北京)有限公司 Location information processing method and device
CN104680336A (en) * 2015-03-24 2015-06-03 深圳市中兴云服务有限公司 Staff position determination method and system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103686698A (en) * 2013-11-13 2014-03-26 百度在线网络技术(北京)有限公司 Location information processing method and device
CN104680336A (en) * 2015-03-24 2015-06-03 深圳市中兴云服务有限公司 Staff position determination method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《基于IPV4的网络地理定位技术研究》;班奇等;《电脑编程技巧与维护》;20160518;第3.4节 *

Also Published As

Publication number Publication date
CN106210163A (en) 2016-12-07

Similar Documents

Publication Publication Date Title
CN106210163B (en) IP address-based localization method and device
CN106027693B (en) IP address-based localization method and device
CN104081339B (en) The data transmission by network connection is managed based on priority and data application plan
CN106448135B (en) Bus routes recommend method and device
CN107566498A (en) A kind of method for monitoring numerical control machine and system based on Internet of Things
CN110035388A (en) Determine method, computer readable storage medium and the terminal device of user area
CN103067297B (en) A kind of dynamic load balancing method based on resource consumption prediction and device
CN107657353A (en) The dispatching method and system of lease
CN105721629B (en) User identifier matching process and device
CN104239453B (en) Data processing method and device
EP2905931B1 (en) Method and apparatus for determining data flow rate of service access port
CN111078818B (en) Address analysis method and device, electronic equipment and storage medium
CN105491529B (en) The memory mapping treatment method and big data platform of mobile terminal locations data
CN109741060A (en) Information inquiry system, method, device, electronic equipment and storage medium
Holleczek et al. Detecting weak public transport connections from cellphone and public transport data
CN104717743B (en) Mobile terminal method for tracing and system based on signalling analysis
CN106850106B (en) Radio environment map data collection system and method based on mobile crowd sensing
CN107944677A (en) Achievement method for tracing, application server and computer-readable recording medium
CN110414778A (en) Case work dispatching method and device
CN111311193B (en) Method and device for configuring public service resources
CN106131238B (en) The classification method and device of IP address
CN110298687A (en) A kind of region attraction appraisal procedure and equipment
CN109102093A (en) The determination method, apparatus and electronic equipment of single hot spot region under a kind of net about vehicle
CN106846795A (en) The acquisition methods and device in the crowd is dense region
CN110830978B (en) User data processing method, device, equipment and medium based on region

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