Invention content
In view of this, the main object of the present invention is to provide a kind of control method and system to network connection, to improveThe data updating efficiency at operating service end, and improve the precise controlling degree to user terminal Web portal.
The technical proposal of the invention is realized in this way:
A kind of control method to network connection, including:
Attribute of the server-side based on user configures corresponding IP address list, two is included at least in an IP address listA IP address, each IP address correspond to a weighted value;
Server-side determines the attribute of the user of the user terminal after receiving the network connecting request of user terminal, searches the useThe corresponding IP address list configured of the attribute at family, the user terminal is returned to by the IP address list;
After the user terminal receives the IP address list, according to the IP address in the IP address list weighted value from high to lowSequence is attempted to connect the IP address successively, be carried out with the connection if successful connection since the highest IP address of weighted valueNetwork communication, if connect it is unsuccessful if reattempt and connect the IP address of low level-one weighted value, until successful connection or the IPAll IP address all connection failures in the list of location.
In an advantageous embodiment, the weighted value of the IP address is the weighted value of the IP address in the IP address listIn the sum of all IP address weighted values accounting.
In an advantageous embodiment, this method further comprises:User terminal is periodically sent out to server-side according to the specified periodThe request for obtaining IP address list is acted, server-side after receiving the request, determines the attribute of the user of the user terminal, searches the useThe corresponding newest IP address list configured of the attribute at family, the newest IP address is returned to the user terminal for initiating requestList.
In an advantageous embodiment, the server-side further configure interface path and domain name correspondence andConfigure the correspondence of domain name and IP address list;
The user terminal obtains the interface path and the correspondence of domain name on startup, to server-side, and is stored inIt is local;
It, will from the corresponding domain name of the local search interface path when user terminal needs to obtain data from certain interface pathThe domain name inquired carries in network connecting request, and the network connecting request is initiated to server-side;Server-side is receiving the netAfter network connection request, the IP address list corresponding to the domain name of its carrying is inquired, and further determine that user property, from the domainThe corresponding IP address list configured of attribute of the user is further inquired in the corresponding IP address list of name, by the IPLocation list returns to the user terminal.
In an advantageous embodiment, this method further comprises:User terminal is periodically sent out to server-side according to the specified periodAct the request for the correspondence for obtaining the interface path and domain name, server-side after receiving the request, to the use for initiating requestFamily end returns to newest interface path and the correspondence of domain name, and user terminal is in pair for receiving the newest interface path and domain nameAfter should being related to, the correspondence of the original interface path and domain name that are locally stored is updated.
A kind of control system to network connection, including server-side and user terminal, wherein server-side include control module againAnd scheduler module,
The control module is used for:Attribute based on user, configures corresponding IP address list, in an IP address listIncluding at least two IP address, each IP address corresponds to a weighted value;
The scheduler module is used for:After server-side receives the network connecting request of user terminal, the use of the user terminal is determinedThe attribute at family searches the corresponding IP address list configured of attribute of the user, which is returned to the useFamily end;
The user terminal is used for:Network connecting request is sent to server-side, in the IP address list for receiving server-side returnAfterwards, it sorts from high to low according to the weighted value of the IP address in the IP address list, since the highest IP address of weighted value, according toSecondary trial connects the IP address, and network communication is carried out with the connection if successful connection, is reattempted if connection is unsuccessfulThe IP address for connecting low level-one weighted value, until all IP address all connection failures in successful connection or the IP address list.
In an advantageous embodiment, the weighted value of the IP address is the weighted value of the IP address in the IP address listIn the sum of all IP address weighted values accounting.
In an advantageous embodiment, the user terminal is further used for periodically obtaining to server-side initiation according to the specified periodTake the request of IP address list;
The scheduler module of the server-side is further used for determining the category of the user of the user terminal after receiving the requestProperty, the corresponding newest IP address list configured of attribute of the user is searched, being returned to the user terminal for initiating request shouldNewest IP address list.
In an advantageous embodiment, the control module of the server-side is further used for configuring interface path and domain nameCorrespondence and the correspondence for configuring domain name and IP address list;
The user terminal is further used on startup, and interface path pass corresponding with domain name is obtained to server-sideSystem, and it is stored in local;When needing to obtain data from certain interface path, from the corresponding domain name of the local search interface path,The domain name inquired is carried in network connecting request, the network connecting request is initiated to server-side;
The scheduler module of the server-side is further used for after receiving the network connecting request, inquires the domain name of its carryingCorresponding IP address list, and further determine that user property, it is further looked into from the corresponding IP address list of domain nameThe corresponding IP address list configured of attribute for asking the user, the user terminal is returned to by the IP address list.
In an advantageous embodiment, the user terminal is further used for periodically obtaining to server-side initiation according to the specified periodThe request of the interface path and the correspondence of domain name is taken, and in the correspondence for receiving newest interface path and domain nameAfterwards, the correspondence of the original interface path and domain name that are locally stored is updated;
The scheduler module of the server-side is further used for after receiving the request, returning most to the user terminal for initiating requestThe correspondence of new interface path and domain name.
Compared with prior art, the present invention is in attribute of the server-side based on user, configures corresponding IP address list, oneTwo IP address are included at least in IP address list, each IP address corresponds to a weighted value;Server-side is receiving user terminalAfter network connecting request, configured corresponding to the attribute of the user of the user terminal IP address list is returned into the userEnd;The user terminal sorts from high to low according to the weighted value of the IP address in the IP address list, from the highest IP of weighted valueLocation starts, and attempts to connect the IP address successively, network communication is carried out with the connection if successful connection, if connection is unsuccessfulThe IP address for connecting low level-one weighted value is then reattempted, until all IP address in successful connection or the IP address list all connectConnect failure.Technical solution through the invention can dispatch customer flow in real time, when needing to carry out Web portal update, onlyIt needs to update the IP address list that server-side configures, it is not necessary to update layer by layer, so as to avoid certain operator DNSs cachingsThe excessively slow problem of data update, improves the data updating efficiency at operating service end, and timeliness is strong.Due to what is returned to user terminalIt is an IP address classification, including at least two IP address, can changes in time when the line fault of some IP addressThe network link of user replaces other IP address, is used to avoid influencing user, and can be targeted according to user propertyGround configures corresponding IP address list.Therefore the present invention can also improve the precise controlling degree to user terminal Web portal, controllablyProperty it is strong, can according to Web portal used in each user terminal of the very delicate control of user property, convenient for save bandwidth atOriginally, convenient for testing, convenient for the cut-in quality of promotion user.
Specific implementation mode
Below in conjunction with the accompanying drawings and specific embodiment the present invention is further described in more detail.
Fig. 1 is a kind of flow diagram of the control method of the present invention to network connection.Referring to Fig. 1, the controlling partyMethod includes mainly:
The attribute of step 101, server-side based on user, configures corresponding IP address list, in an IP address list extremelyInclude two IP address less, each IP address corresponds to a weighted value;
Step 102, server-side determine the attribute of the user of the user terminal after receiving the network connecting request of user terminal,The corresponding IP address list configured of attribute for searching the user, the user terminal is returned to by the IP address list;
After step 103, the user terminal receive the IP address list, according to the weighted value of the IP address in the IP address listIt sorts from high to low, since the highest IP address of weighted value, attempts to connect the IP address successively, with this if successful connectionConnection carries out network communication, the IP address for connecting low level-one weighted value is reattempted if connection is unsuccessful, until successful connectionOr all IP address all connection failures in the IP address list.
Corresponding with the method, the invention also discloses a kind of control systems to network connection.Fig. 2 is institute of the present inventionState the composition schematic diagram to the control system of network connection.Referring to Fig. 2, which includes mainly server-side and user terminal,Wherein server-side again include control module and scheduler module,
The control module is used for:Attribute based on user, configures corresponding IP address list, in an IP address listIncluding at least two IP address, each IP address corresponds to a weighted value;The IP address list can be only fitted to a configurationIn center, which is used for storage configuration data, which can be arranged in server-side local, can also be arrangedOn remote server.
The scheduler module is used for:After server-side receives the network connecting request of user terminal, the use of the user terminal is determinedThe attribute at family searches the IP address list configured corresponding to the attribute of the user from the configuration center, by the IP addressList returns to the user terminal.
The user terminal is used for:Network connecting request is sent to server-side, in the IP address list for receiving server-side returnAfterwards, it sorts from high to low according to the weighted value of the IP address in the IP address list, since the highest IP address of weighted value, according toSecondary trial connects the IP address, and network communication is carried out with the connection if successful connection, is reattempted if connection is unsuccessfulThe IP address for connecting low level-one weighted value, until all IP address all connection failures in successful connection or the IP address list.
The control module is substantially to be used for controlling the dynamic dispatching for user, and main task is to be configured and controlledSystem.
In an advantageous embodiment, the configuration information that the control module is configured includes mainly the attribute according to userThe IP address list of corresponding configuration, the user property is for example including region, user identifier (ID), circuit used, gender, workJerk etc..In an advantageous embodiment, each attribute based on user can be required for one IP list of configuration, the IPTwo IP address are included at least in list to be used for ensureing High Availabitity, when some IP address fails, can also be used anotherA or other IP address.Each IP address in the IP address list can configure a numerical value and be used for indicating weight, weighIt is again higher, just there are more users to use the IP address, in an advantageous embodiment, the weighted value of the IP address is the IPThe accounting of the weighted value of address the sum of all IP address weighted values in the IP address list.The user terminal is according to service logicDemand when need to carry out network connection to carry out data interaction, to server-side can send out network connecting request;Server-sideScheduler module receive the network connecting request of the user terminal after, inquire the attribute information of the user terminal, such as the user terminal instituteThe region of category, the gender of the user terminal, the user terminal nearest a period of time liveness how etc., then according to inquiringUser property the IP address list is returned to the corresponding IP address list of the user property is inquired in the configuration centerBack to the user terminal.The user terminal sorts from high to low according to the weighted value of the IP address in the IP address list, from weighted valueHighest IP address starts, and attempts to connect the IP address, all IP in successful connection or the IP address list successivelyAddress all connection failures.
In a further embodiment, server-side can be adjusted according to variations such as network environment, service logics in control moduleThe configuration informations such as IP address list, it is therefore desirable to there is a kind of mechanism to be made to allow user terminal to obtain server-side in timeUpdate.Therefore, the above method can further include:User terminal periodically initiated to obtain IP to server-side according to the specified periodThe request of address list;The scheduler module of the server-side after receiving the request, determines the attribute of the user of the user terminal, looks intoThe corresponding newest IP address list configured of the attribute of the user is looked for, it is newest to return to this to the user terminal for initiating requestIP address list.
In another preferred embodiment, the configuration information that the control module is configured further includes following two categories, a kind ofIt is used to refer to the corresponding domain-name information of bright interface path, that is, needs to configure interface path and the correspondence of domain name;It is another kind of to beAlso to configure the correspondence of domain name and IP address list, and these IP address lists be also required to it is opposite with the attribute of userIt answers, i.e., each user property can all have corresponding IP address list.Equally, two IP address are included at least in the IP lists to useEnsure High Availabitity, when some IP address fails when, another or other IP address can also be used.The IP addressEach IP address in list can configure a numerical value and be used for indicating weight, and weight is higher, and just having more users to use shouldIP address, in an advantageous embodiment, the weighted value of the IP address are the weighted value of the IP address in the IP address listIn the sum of all IP address weighted values accounting.
Fig. 3 is a kind of flow chart of embodiment of network connection control method of the present invention.Referring to Fig. 3, this excellentIt selects in embodiment, the user terminal on startup, can obtain the interface path and the correspondence of domain name, and deposit to server-sideStorage is in local.Such as the interface path is /stock/quote.json, then its corresponding domain name isstock.xueqiu.com。
It, will from the corresponding domain name of the local search interface path when user terminal needs to obtain data from certain interface pathThe domain name inquired carries in network connecting request, and the network connecting request is initiated to server-side;For example, user terminal is according to industryBusiness logic, when needing to obtain data from interface path/stock/quote.json, then can inquire needs correspondence to be usedDomain name is stock.xueqiu.com, is asked in network connection then user terminal can carry this domain name stock.xueqiu.comIn asking.
The scheduler module of server-side inquires the IP address corresponding to the domain name of its carrying after receiving the network connecting requestList, and further determine that the user property of the user, further inquire the use from the corresponding IP address list of domain nameThe corresponding IP address list configured of the attribute at family, the user terminal is returned to by the IP address list.The user terminal according toThe weighted value of IP address in the IP address list sorts from high to low, since the highest IP address of weighted value, attempts successivelyThe IP address is connected, until all IP address all connection failures in successful connection or the IP address list.
In the embodiment described in figure 3, the user terminal, can also be according to after the IP address list for receiving server-side returnAccording to weight, successively judge whether there is available IP address in IP address list, has then according to the IP address list requested service numberAccording to for asking the IP address of failure then by the IP address labeled as unavailable.It will can also further be labeled as usingIP address feed back to server-side, according to the feedback of user terminal the IP address is modified or is investigated network by server-side thereforeBarrier.
In a further embodiment, server-side can be adjusted according to variations such as network environment, service logics in control moduleConfiguration information, it is therefore desirable to have a kind of mechanism to allow user terminal to obtain the update that server-side is made in time.Therefore,The present invention can further include:The user terminal periodically initiates to connect described in acquisition further according to the specified period to server-sideThe request of the correspondence of mouthful path and domain name, the scheduler module of server-side after receiving the request, to the user for initiating requestEnd returns to the correspondence of newest interface path and domain name, and user terminal is to receive the newest interface path corresponding with domain nameAfter relationship, the correspondence of the original interface path and domain name that are locally stored is updated.
The present invention maintains the corresponding IP lists of a variety of attributes and its weight of IP address of each user in server-side, andAnd the IP address list that can be really used according to the environmental variances such as business datum dynamic adjustment user terminal.User terminal can obtainAvailable IP is used successively to the corresponding IP address list of this user property, and according to the IP address list, it is ensured that user's asksThe problem of network link causes can be avoided by asking, while client can be updated periodically IP address list according to configuration, ensure clothesModification of the business end to the interface path, domain name, and/or IP address, can come into force, in a short period of time so as to realityThe inlet flow rate of existing Real-Time Scheduling user.
DNS cache in compared with the existing technology updates slow problem, and the present invention can be by avoiding transporting using third partyThe public DNS of quotient is sought, directly obtains domain name relationship corresponding with IP using the our server-side built, there is no asking for cachingTopic, timeliness are strong.
Customer flow in compared with the existing technology can not careful regulation the problem of, what operator in the prior art supportedDNS systems can not be supported to classify to user using internal attribute data, can not accomplish fine to navigate to a certain useThe flow control at family.And the present invention can correspond to configuration IP address list according to user property, the user property can be accurateIt is sub-divided into specific User ID, therefore can be as accurate as carrying out network connection for a certain user, accurately controls customer flowEntrance.
In addition, the present invention can also dynamically change the domain name of user terminal request, to neatly control the access of userPoint.
In addition, each function module in each embodiment of the present invention can be integrated in a processing unit, it can alsoIt is that modules physically exist alone, it can also be during two or more modules be integrated in one unit.Above-mentioned integrated listThe form that hardware had both may be used in member is realized, can also be realized in the form of SFU software functional unit.The work(of each embodimentEnergy module can be located at a terminal or network node, or may be distributed on multiple terminals or network node.
In addition, each embodiment of the present invention can pass through the data processing by data processing equipment such as computer executionProgram is realized.Obviously, data processor constitutes the present invention.In addition, being generally stored inside the data in a storage mediumProcessing routine by program by directly reading out storage medium or by installing or copying to data processing equipment by programIt is executed in storage device (such as hard disk and/or memory).Therefore, such storage medium also constitutes the present invention.Storage medium can be withUse any kind of recording mode, such as paper storage medium (such as paper tape), magnetic storage medium (such as floppy disk, hard disk, flash memoryDeng), optical storage media (such as CD-ROM), magnetic-optical storage medium (such as MO) etc..
Therefore the invention also discloses a kind of storage mediums, wherein it is stored with data processor, the data processorAny type embodiment for executing the above method of the present invention.
In addition, method and step of the present invention is with data processor in addition to can be realized, can also by hardware LaiIt realizes, for example, can be by logic gate, switch, application-specific integrated circuit (ASIC), programmable logic controller (PLC) and embedded microcontrollerEtc. realizing.Therefore this hardware that the method for the invention may be implemented can also constitute the present invention.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present inventionWith within principle, any modification, equivalent substitution, improvement and etc. done should be included within the scope of protection of the invention god.