A kind of method for network access and user terminalTechnical field
The present invention relates to electronic technology field, particularly a kind of method that connects of network and user terminal.
Background technology
Along with the development of the network communications technology, the covering of wireless network is more and more wider, except household internal and intra-company are coated with except WLAN (wireless local area network) WLAN, a lot of public place is also coated with WLAN, and on such as bus, hotel, airport, the place such as dining room be also all coated with WLAN.
Nowadays, part WLAN is that full open model does not limit by the authentication information such as user name, password, can access and directly access Internet, but still have WLAN greatly to allow user terminal access because of a variety of causes, but redirect goes out a certification webpage when user terminal accesses a certain webpage by this WLAN, require that user terminal inputs the authentication information such as user name, service password, certification could access this webpage after passing through.
But present inventor, in the process realizing technical scheme in the embodiment of the present application, finds that prior art exists following technical problem:
In the prior art, when there is the networks such as WLAN and 3G/2G/LTE at the same time, user's usual prioritizing selection access WLAN visits Internet, when WLAN redirect goes out conscientious webpage, user does not know that corresponding user name and service password just cannot access Internet, and now user terminal also cannot carry out the switching of internetwork connection mode automatically, visit Internet by other networks, bring inconvenience to user.There is the technical problem automatically cannot carrying out internetwork connection mode switching in visible user terminal of the prior art.
Summary of the invention
The embodiment of the present invention provides a kind of method for network access and user terminal, for solving the technical problem automatically cannot carrying out internetwork connection mode switching that user terminal of the prior art exists, realizes the automatic switchover of internetwork connection mode.
The embodiment of the present application provides a kind of method for network access, and described method comprises:
When the current network connected mode of terminal is first network connected mode, described terminal initiates the access request of access Web page to access controller;
Described terminal receives the response message for responding described access request, and described response message comprises the HTTP conditional code characterizing http response state;
Described in described terminal judges, whether HTTP conditional code meets pre-conditioned, obtains the first judged result;
If described first judged result show described HTTP conditional code meet described pre-conditioned time, described current network connected mode is switched to the second network connected mode different from described first network connected mode by described first network connected mode by described terminal.
Preferably, when described first network connected mode is WLAN connected mode, described in described terminal judges, whether HTTP conditional code meets pre-conditioned, obtains the first judged result, is specially:
Judge whether described HTTP conditional code is the redirected conditional code characterizing HTTP redirection;
When described HTTP conditional code is described redirected conditional code, it is described pre-conditioned that described first judged result shows that described HTTP conditional code meets; When described HTTP conditional code is not described redirected conditional code, it is described pre-conditioned that described first judged result shows that described HTTP conditional code does not meet.
Preferably, described current network connected mode is switched to the second network connected mode different from described first network connected mode by described first network connected mode by described terminal, specifically comprises:
Judge whether described terminal opens the automatic switching function for automatically switching network connected mode, obtain the second judged result;
If when described second judged result shows that described terminal has opened described automatic switching function, described first network connected mode is switched to described second network connected mode by described terminal automatically.
Preferably, described terminal receives the response message for responding described access request, and described response message comprises the HTTP conditional code characterizing http response state, specifically comprises:
Judge whether receive described response message in preset time period, obtain the 3rd judged result;
When described 3rd judged result is for being, described terminal obtains described HTTP conditional code by receiving described response message.
Preferably, whether receive described response message in described judgement in preset time period, after obtaining the 3rd judged result, described method comprises:
When described 3rd judged result is no, judge whether described terminal opens the automatic switching function for automatically switching network connected mode, obtain the 4th judged result;
If when described 4th judged result shows that described terminal has opened described automatic switching function, described first network connected mode is switched to described second network connected mode by described terminal automatically.
The embodiment of the present application also provides a kind of user terminal, and described user terminal comprises:
Transmitting element, for when the current network connected mode of described user terminal is first network connected mode, initiates the access request of access Web page to access controller;
Receiving element, for receiving the response message for responding described access request, described response message comprises the HTTP conditional code characterizing http response state;
Judging unit, for judging whether described HTTP conditional code meets pre-conditioned, obtains the first judged result;
Switch unit, for show in described first judged result described HTTP conditional code meet described pre-conditioned time, described current network connected mode is switched to the second network connected mode different from described first network connected mode by described first network connected mode.
Preferably, described judging unit specifically for:
When described first network connected mode is WLAN connected mode, judge whether described HTTP conditional code is the redirected conditional code characterizing HTTP redirection;
When described HTTP conditional code is described redirected conditional code, obtaining the first judged result, to show that described HTTP conditional code meets described pre-conditioned; When described HTTP conditional code is not described redirected conditional code, obtaining the first judged result, to show that described HTTP conditional code does not meet described pre-conditioned.
Preferably, switch unit specifically for:
Judge whether described user terminal opens the automatic switching function for automatically switching network connected mode, obtain the second judged result;
If when described second judged result shows that described user terminal has opened described automatic switching function, described first network connected mode is switched to described second network connected mode.
Preferably, described receiving element specifically for:
Judge whether receive described response message in preset time period, obtain the 3rd judged result;
When described 3rd judged result is for being, described terminal obtains described HTTP conditional code by receiving described response message.
Preferably, described switch unit also for:
When described 3rd judged result is no, judge whether described user terminal opens the automatic switching function for automatically switching network connected mode, obtain the 4th judged result;
When described 4th judged result shows that described user terminal has opened described automatic switching function, automatically described first network connected mode is switched to described second network connected mode.
Above-mentioned one or more technical scheme in the embodiment of the present application, at least has following technique effect:
When terminal is with first network connected mode access network, terminal initiates the access request of access Web page to access controller AC; Whether the HTTP conditional code comprised in the response message that terminal sends by judging access controller to respond this access request meets pre-conditioned, and when HTTP conditional code meets pre-conditioned, automatically current first network connected mode is switched to the second connected mode, thus solve the technical problem automatically cannot carrying out internetwork connection mode switching of user terminal of the prior art existence, reach the technique effect of automatically switching network connected mode.
Accompanying drawing explanation
The schematic flow sheet of a kind of method for network access that Fig. 1 provides for the embodiment of the present application one;
The schematic flow sheet connecting internet without the need to terminal during certification that Fig. 2 provides for the embodiment of the present application one;
Fig. 3 for the embodiment of the present application one provide need certification time terminal connect the schematic flow sheet of internet;
The response schematic diagram of the different HTTP conditional code of terminal response that Fig. 4 provides for the embodiment of the present application one;
The block diagram of a kind of user terminal that Fig. 5 provides for the embodiment of the present application two.
Embodiment
In the technical scheme that the embodiment of the present application provides, pre-conditionedly determine that the wireless network of the current access of terminal is the need of by being just connected to Internet after purview certification by judging whether HTTP conditional code meets, and when determining that the wireless network of current access needs purview certification, automatically current first network connected mode is switched to second network connected mode, thus solve the technical problem automatically cannot carrying out internetwork connection mode switching of user terminal of the prior art existence, reach the technique effect of automatically switching network connected mode.
Below in conjunction with accompanying drawing, the main of the embodiment of the present application technical scheme is realized principle, embodiment and be explained in detail the beneficial effect that should be able to reach.
Embodiment one
Please refer to Fig. 1, the embodiment of the present application provides a kind of method for network access, and the method comprises:
S101: when the current network connected mode of terminal is first network connected mode, described terminal initiates the access request of access Web page to access controller;
S102: described terminal receives the response message for responding described access request, described response message comprises the HTTP conditional code characterizing http response state;
S103: described in described terminal judges, whether HTTP conditional code meets pre-conditioned, obtains the first judged result;
S104: if to show that described HTTP conditional code meets described pre-conditioned for described first judged result, described current network connected mode is switched to the second network connected mode different from described first network connected mode by described first network connected mode by described terminal.
In specific implementation process, terminal can pass through accessing WLAN network (Wireless Local AreaNetworks, WLAN) mode accesses Internet, also can access Internet by modes such as accessing mobile communication network 3G/2G/LTE.After terminal is by above either type access network, based on HTML (Hypertext Markup Language) (Hypertext Transfer Protocol, HTTP), Web page is conducted interviews.
When conducting interviews to Web page, first perform S101 when the current network connected mode of terminal is first network connected mode, terminal initiates the access request of access Web page to access controller (Access Controller, AC).Concrete, first network connected mode can be WLAN connected mode, may also be the mobile communications network connected modes such as 3G/2G/LTE.After initiation access request, and then perform S102.
S102: terminal receives the response message for responding access request, this response message comprises the HTTP conditional code characterizing http response state.Please refer to Fig. 2 and Fig. 3, under normal circumstances in the mobile communications network such as 3G/2G/LTE access controller when receiving access request, access request directly can be forwarded to Internet server, Internet server response access request by access controller to terminal feedback HTTP conditional code; During the certification of WLAN lack of competence, to access the process of Internet the same for the mobile communications network such as process and 3G/2G/LTE of its access Internet, also can feed back HTTP conditional code; When WLAN has permission certification, access controller, can to terminal feedback HTTP redirection conditional code when receiving access request, and therefore, tube terminal all will receive HTTP conditional code all under normal circumstances by what mode interconnection network.Due to the different responsive states of different HTTP conditional code reaction web page server, and can the network access mode of the current employing of reactive terminal further the need of through Authority Verification, so next perform S103.
Whether S103: terminal judges HTTP conditional code meets pre-conditioned, obtains the first judged result.Concrete, HTTP conditional code comprises the conditional code characterizing different implication, as: characterize access request be accepted need continue process transitory state code, characterize access request success by web page server receive, understands and the success status code accepted, sign HTTP redirection namely need terminal to take further operation just can complete the redirected conditional code etc. of request.
The internetwork connection mode difference that terminal is current, the deterministic process of S103 is different.When the internetwork connection mode of terminal is WLAN connected mode, namely the mode by accessing WLAN enters the Internet, if WLAN needs purview certification eventually, end then can receive redirected conditional code, therefore, when first network connected mode is WLAN connected mode, whether the HTTP conditional code that terminal judges receives is the redirected conditional code characterizing HTTP redirection; When the HTTP conditional code received is redirected conditional code, it is described pre-conditioned that described first judged result shows that described HTTP conditional code meets; When described HTTP conditional code is not described redirected conditional code, it is described pre-conditioned that described first judged result shows that described HTTP conditional code does not meet.
When the internetwork connection mode of terminal is the mobile communications network connected modes such as 3G/2G/LTE, terminal is entered the Internet by the mode of accessing mobile communication network, mobile communications network does not need purview certification under normal circumstances, but the situation of less stable may be there is in the mobile communications network in some place, terminal needs the transmitting-receiving power of constantly adjustment oneself, thus unusual power consumption, and network speed is also abnormal in this case has a strong impact on Consumer's Experience slowly.Terminal may receive and characterize the HTTP conditional code of request timed out in these cases, and as 3 digit numerical code 408 of regulation in http protocol 1.1 editions, so whether the HTTP conditional code that receives of terminal judges is the timeout mode code of identification request time-out; When the HTTP conditional code received is timeout mode code, it is described pre-conditioned that described first judged result shows that described HTTP conditional code meets; When described HTTP conditional code is not described timeout mode code, it is described pre-conditioned that described first judged result shows that described HTTP conditional code does not meet.
When the first judged result shows that HTTP conditional code meets pre-conditioned, perform S104 terminal further and current network connected mode is switched to the second network connected mode different from first network connected mode by first network connected mode.Concrete, when first network connected mode is WLAN connection, the HTTP conditional code that terminal receives is for being redirected conditional code, show that the WLAN that terminal accesses has permission certification, to make troubles in order to avoid user cannot enter the Internet because not knowing username and password to user, in the embodiment of the present application, terminal now will switch to the mobile communications network connected modes such as 3G/2G/LTE from WLAN connected mode automatically.
Please refer to Fig. 4, be made up of in http protocol 1.1 editions 3 digit numerical code, i.e. the 3XX of wherein 3 word beginnings is for being redirected conditional code, i.e. the 2XX of 2 word beginnings is success status code, and wherein X represents Arbitrary Digit.When terminal access WLAN accesses Web page, if receive the HTTP conditional code of 2XX, represent and access successfully, terminal directly can connect Internet; If receive the HTTP conditional code of 3XX, represent that the WLAN that namely HTTP redirection accesses has permission certification, and username and password is not normally had for strange WLAN user, Internet cannot be connected by this WLAN, so now terminal is just automatic, and internetwork connection mode is switched to the connected modes such as 3G/2G/LTE, connect Internet by mobile communications networks such as 3G/2G/LTE.
In specific implementation process, terminal is when switching to second network connected mode by current network connected mode by first network connected mode, specifically first can judge that whether terminal opens the automatic switching function for automatically switching network connected mode, obtains the second judged result.Second judged result is no, terminal does not open automatic switching function, show that user does not need terminal to perform automatically switching network attended operation, so the HTTP conditional code received for be redirected conditional code, terminal redirect also shows the certification page of WLAN, waits for that user inputs user name, password etc. and completes certification.Second judged result is yes, and terminal opens automatic switching function, and show that user's terminal of getting performs automatically switching network attended operation, so first network connected mode is switched to second network connected mode by terminal automatically.Terminal is when automatic switching function is opened, and that just automatically carries out internetwork connection mode cuts family, and avoiding terminal does not need to carry out switching when internetwork connection mode switches user, improves Consumer's Experience.
In specific implementation process, no matter terminal current network access way is WLAN or 3G/2G/LTE, equal possibility is because network environment reason cause access request to can not get response, in order to avoid terminal is in the state of wait-for-response for a long time, terminal is when receiving the response message for responding access request, specifically first can judge the response message whether receiving response terminal access request in preset time period, obtain the 3rd judged result; In the 3rd judged result for being when showing that present access network is normal, terminal obtains HTTP conditional code by receiving response message, now performs S103 further; Show that when the 3rd judged result is no present access network exists network speed when crossing the problem such as slow, judge whether terminal opens the automatic switching function for automatically switching network connected mode, acquisition the 4th judged result.If when the 4th judged result shows that terminal has opened described automatic switching function, first network connected mode is switched to second network connected mode by terminal automatically; Contrary, if the 4th judged result shows that terminal does not open automatic switching function, then continue through present access network and accept HTTP conditional code.
In the above-described embodiments, whether the HTTP conditional code comprised in the response message that terminal sends by judging access controller to respond this access request meets pre-conditioned, and when HTTP conditional code meets pre-conditioned showing by present Access access Web needs purview certification, automatically current first network connected mode is switched to the second connected mode, thus solve the technical problem automatically cannot carrying out internetwork connection mode switching of user terminal of the prior art existence, reach the technique effect of automatically switching network connected mode.
Embodiment two
Please refer to Fig. 5, the embodiment of the present application provides a kind of user terminal, and described user terminal comprises:
Transmitting element 501, for when the current network connected mode of described user terminal is first network connected mode, initiates the access request of access Web page to access controller;
Receiving element 502, for receiving the response message for responding described access request, described response message comprises the HTTP conditional code characterizing http response state;
Judging unit 503, for judging whether described HTTP conditional code meets pre-conditioned, obtains the first judged result;
Switch unit 504, for show in described first judged result described HTTP conditional code meet described pre-conditioned time, described current network connected mode is switched to the second network connected mode different from described first network connected mode by described first network connected mode.
In specific implementation process, described judging unit 503 specifically for: when described first network connected mode is WLAN connected mode, judge that whether described HTTP conditional code is the redirected conditional code characterizing HTTP redirection; When described HTTP conditional code is described redirected conditional code, obtaining the first judged result, to show that described HTTP conditional code meets described pre-conditioned; When described HTTP conditional code is not described redirected conditional code, obtaining the first judged result, to show that described HTTP conditional code does not meet described pre-conditioned.
In specific implementation process, switch unit 504 specifically for: judge whether described user terminal opens the automatic switching function for automatically switching network connected mode, obtain the second judged result; If when described second judged result shows that described user terminal has opened described automatic switching function, described first network connected mode is switched to described second network connected mode.
In specific implementation process, described receiving element 502 specifically for: judge whether receive described response message in preset time period, obtain the 3rd judged result; When described 3rd judged result is for being, described terminal obtains described HTTP conditional code by receiving described response message.
In specific implementation process, described switch unit 504 also for: when described 3rd judged result is no, judge whether described user terminal opens the automatic switching function for automatically switching network connected mode, obtain the 4th judged result; When described 4th judged result shows that described user terminal has opened described automatic switching function, automatically described first network connected mode is switched to described second network connected mode.
By the one or more technical schemes in the embodiment of the present application, following technique effect can be realized:
When terminal is with first network connected mode access network, terminal initiates the access request of access Web page to access controller AC; Whether the HTTP conditional code comprised in the response message that terminal sends by judging access controller to respond this access request meets pre-conditioned, and when HTTP conditional code meets pre-conditioned, automatically current first network connected mode is switched to the second connected mode, thus solve the technical problem automatically cannot carrying out internetwork connection mode switching of user terminal of the prior art existence, reach the technique effect of automatically switching network connected mode.
Those skilled in the art should understand, embodiments of the invention can be provided as method, system or computer program.Therefore, the present invention can adopt the form of complete hardware embodiment, completely software implementation or the embodiment in conjunction with software and hardware aspect.And the present invention can adopt in one or more form wherein including the upper computer program implemented of computer-usable storage medium (including but not limited to magnetic disc store, CD-ROM, optical memory etc.) of computer usable program code.
The present invention describes with reference to according to the flow chart of the method for the embodiment of the present invention, equipment (system) and computer program and/or block diagram.Should understand can by the combination of the flow process in each flow process in computer program instructions realization flow figure and/or block diagram and/or square frame and flow chart and/or block diagram and/or square frame.These computer program instructions can being provided to the processor of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing device to produce a machine, making the instruction performed by the processor of computer or other programmable data processing device produce device for realizing the function of specifying in flow chart flow process or multiple flow process and/or block diagram square frame or multiple square frame.
These computer program instructions also can be stored in can in the computer-readable memory that works in a specific way of vectoring computer or other programmable data processing device, the instruction making to be stored in this computer-readable memory produces the manufacture comprising command device, and this command device realizes the function of specifying in flow chart flow process or multiple flow process and/or block diagram square frame or multiple square frame.
These computer program instructions also can be loaded in computer or other programmable data processing device, make on computer or other programmable devices, to perform sequence of operations step to produce computer implemented process, thus the instruction performed on computer or other programmable devices is provided for the step realizing the function of specifying in flow chart flow process or multiple flow process and/or block diagram square frame or multiple square frame.
Although describe the preferred embodiments of the present invention, those skilled in the art once obtain the basic creative concept of cicada, then can make other change and amendment to these embodiments.So claims are intended to be interpreted as comprising preferred embodiment and falling into all changes and the amendment of the scope of the invention.
Obviously, those skilled in the art can carry out various change and modification to the present invention and not depart from the spirit and scope of the present invention.Like this, if these amendments of the present invention and modification belong within the scope of the claims in the present invention and equivalent technologies thereof, then the present invention is also intended to comprise these change and modification.