Content of the invention
Present invention is primarily targeted at proposing a kind of intelligent terminal to access the method and device of internet it is intended to solveCertainly in prior art, while the wireless network card of terminal device is in listening mode, crawl and parsing mass data bagWhen being constantly trying to be connected with router, it will lead to the wireless network card crash issue of intelligent terminal.
For achieving the above object, embodiment of the present invention first aspect provides a kind of intelligent terminal to access the side of internetMethod, methods described includes step:
S1:Start WPA_Supplicant process, and the service set using default router and password carry out netNetwork connects;
S2:If network connection failure, close WPA_Supplicant process, and start the monitoring mould of intelligent terminalFormula;
S3:Capture and parse wireless data packet;
S4:It is confirmed whether to get the service set of router and password, if getting the service set of routerAnd password, then execution step S5;Otherwise execution step S3;
S5:Update service set and the password of default router, close the listening mode of intelligent terminal, and holdRow step S1.
In conjunction with the embodiment of the present invention in a first aspect, the embodiment of the present invention first aspect the first implementation in,The service set of described default router and password include the service set of router obtaining from specified file andPassword, or service set when router dispatches from the factory and password.
In conjunction with the embodiment of the present invention in a first aspect, the embodiment of the present invention first aspect second implementation in,Step is also included before described step S2:
S2.0:If network connection success, start the network connection work of intelligent terminal.
In conjunction with the embodiment of the present invention in a first aspect, the embodiment of the present invention first aspect the third implementation in,Described step S3 includes step:
S3.0:Crawl wireless data packet;
S3.1:It is confirmed whether to grab wireless data packet;If grabbing wireless data packet, parse this wireless data packet;Otherwise execution step S3.0 bag.
4th kind of possible implementation of the first aspect of the embodiment of the present invention, in conjunction with the first party of the embodiment of the present inventionThe second implementation of the first implementation of face or first aspect or first aspect or the of first aspectThree kinds of implementations, the wireless data packet that described wireless data packet sends for mobile terminal.
Additionally, for achieving the above object, embodiment of the present invention second aspect provides a kind of intelligent terminal to access interconnectionThe device of net, described device includes:Start processing module, first close processing module, crawl parsing module, confirm module and theTwo closing processing modules;
Described startup processing module, for starting WPA_Supplicant process, and the service using default routerSet identifier and password carry out network connection;
Described first closing processing module, if for network connection failure, closes WPA_Supplicant process, and opensThe listening mode of dynamic intelligent terminal;
Described crawl parsing module, for capturing and parsing wireless data packet;
Described confirmation module, for being confirmed whether to get the service set of router and password, if get routeThe service set of device and password, then generate and enable signal to described second closing processing module;Otherwise generate enable signal to giveDescribed crawl parsing module;
Described second closing processing module, for according to the described enable signal confirming that module generates, updating default roadBy service set and the password of device, close the listening mode of intelligent terminal, and generate enable signal at described startupReason module.
In conjunction with the second aspect of the embodiment of the present invention, in the first implementation of the second aspect of the embodiment of the present invention,The service set of described default router and password include the service set of router obtaining from specified file andPassword, or service set when router dispatches from the factory and password.
In conjunction with the second aspect of the embodiment of the present invention, in the second implementation of the second aspect of the embodiment of the present invention,Described device also includes work starting module;
Described work starting module, if for network connection success, start the network connection work of intelligent terminal.
In conjunction with the second aspect of the embodiment of the present invention, in the third implementation of the second aspect of the embodiment of the present invention,Described crawl parsing module includes placement unit and confirms resolution unit;
Described placement unit, for capturing wireless data packet;
Described confirmation resolution unit, is used for being confirmed whether to grab wireless data packet;If grabbing wireless data packet, solveAnalyse this wireless data packet;Otherwise generate and enable signal to described placement unit.
4th kind of possible implementation of the second aspect of the embodiment of the present invention, in conjunction with the second party of the embodiment of the present inventionThe second implementation of the first implementation of face or second aspect or second aspect or the of second aspectThree kinds of implementations, the wireless data packet that described wireless data packet sends for mobile terminal.
Intelligent terminal provided in an embodiment of the present invention accesses the method and device of internet, by first closing WPA_Supplicant process, starts listening mode and captures and parse wireless data packet, get the service set of router and closeClose Monitor pattern after code, then start WPA_Supplicant process, connection route device.Solve intelligent terminalCapture and parsing mass data bag while be constantly trying to be connected with router when, the intelligent terminal leading to wirelessNetwork interface card crash issue.Achieve the effect that intelligent terminal safely and steadly accesses internet.
Specific embodiment
It should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
Realize each embodiment of the present invention referring now to Description of Drawings.In follow-up description, using for representing, only for being conducive to the explanation of the present invention, itself is not special for the suffix of such as " module ", " part " or " unit " of elementFixed meaning.
As shown in figure 1, first embodiment of the invention proposes a kind of method that intelligent terminal accesses internet, the methodIncluding step:
S1:Start WPA_Supplicant process, and the service set using default router and password carry out netNetwork connects;
In the present embodiment, cross compile WPA_Supplicant instrument, and download to intelligent terminal, give to holdRow authority.WPA_Supplicant is primarily used to support WEP, WPA/WPA2 and WPAI wireless protocols and encryption certification, andActual action is that (socket is referred to as socket, for describing IP address and port, is a communication chain by socketHandle, can be used to realize the communication between different virtual machine or computer) interact data reported user with driving, andUser can send commands to WPA_Supplicantt by socket and transfer driving thus realizing wifi chip is graspedMake, briefly, WPA_Supplicant is exactly the terminal of wifi driving and user and agreement and encryption certification are propped upHold.
In the present embodiment, the service set of default router and password include the route obtaining from specified fileThe service set of device and password, or service set when router dispatches from the factory and password.If First Contact Connections router,Service set when can be dispatched from the factory using router and password carry out network connection.
S2:If network connection failure, close WPA_Supplicant process, and start the monitoring mould of intelligent terminalFormula;
In the present embodiment, may include step before step S2:
S2.0:If network connection success, start the network connection work of intelligent terminal.Specifically, intelligent terminalEquipment can start DHCP (Dynamic Host Configuration Protocol, DHCP) service, dynamicallyDistribution IP address.
When intelligent terminal enables listening mode, can constantly capture all of wireless data packet of surrounding.And work as intelligenceWhen energy terminal device starts WPA_Supplicant process, can constantly attempt being connected with router.If intelligent terminalOpen listening mode and WPA_Supplicant process, intelligent terminal not only will capture and parse substantial amounts of no line number simultaneouslyAccording to bag, also to be constantly trying to be connected with router simultaneously, the performance of intelligent terminal so can be made to reduce.Especially in ringIn the case of the complexity of border, some wireless data packet are possible to not grab, or do not capture completely, or have not parsedEntirely, therefore intelligent terminal can constantly packet capturing simultaneously, unpacking, this process of connection route device, so can make intelligent terminalThe resource overhead of equipment becomes very big, and then leads to the collapse of the wireless network card of intelligent terminal.
Therefore, start before listening mode is captured and parsed wireless data packet it is necessary to close in intelligent terminalClose WPA_Supplicant process, stop being attached with router;When the service set getting router and password itAfterwards, close listening mode, start WPA_Supplicant process, connection route device.So intelligent terminal could be reduced noThe expense of gauze card, and make full use of the resource of wireless network card, the mode finally realizing timesharing completes to obtain the service of routerSet identifier and password and startup WPA_Supplicant process connection route device.
S3:Capture and parse wireless data packet;
In the present embodiment, step S3 may include step:
S3.0:Crawl wireless data packet;
S3.1:It is confirmed whether to grab wireless data packet;If grabbing wireless data packet, parse this wireless data packet;Otherwise execution step S3.0.
In the present embodiment, the wireless data packet that wireless data packet can send for mobile terminal.
S4:It is confirmed whether to get the service set of router and password, if getting the service set of routerAnd password, then execution step S5;Otherwise execution step S3;
S5:Update service set and the password of default router, close the listening mode of intelligent terminal, and holdRow step S1.
The method that intelligent terminal provided in an embodiment of the present invention accesses internet, by first closing WPA_Supplicant process, starts listening mode and captures and parse wireless data packet, get the service set of router and closeClose Monitor pattern after code, then start WPA_Supplicant process, connection route device.Solve intelligent terminalCapture and parsing mass data bag while be constantly trying to be connected with router when, the intelligent terminal leading to wirelessNetwork interface card crash issue.Achieve the effect that intelligent terminal safely and steadly accesses internet.
The present invention further provides a kind of device.
With reference to Fig. 2 and Fig. 3, a kind of intelligent terminal that Fig. 2 and Fig. 3 proposes for second embodiment of the invention accesses interconnectionThe device of net, device 200 includes:Start processing module 201, first to close processing module 202, crawl parsing module 203, confirmModule 204 and the second closing processing module 205;
Start processing module 201, for starting WPA_Supplicant process, and the services set using default routerMark and password carry out network connection;
In the present embodiment, cross compile WPA_Supplicant instrument downloads to intelligent terminal, gives can performAuthority.WPA_Supplicant is primarily used to support WEP, WPA/WPA2 and WPAI wireless protocols and encryption certification, and realThe action on border is that (socket is referred to as socket, for describing IP address and port, is a communication chain by socketHandle, can be used to realize the communication between different virtual machine or computer) with driving to interact, data is reported user, and useFamily can send commands to WPA_Supplicantt by socket and transfer driving thus realizing wifi chip is graspedMake, briefly, WPA_Supplicant is exactly that wifi driving is additional with the terminal of user to be propped up to agreement and encryption certificationHold.
In the present embodiment, the service set of default router and password include the route obtaining from specified fileThe service set of device and password, or service set when router dispatches from the factory and password.If First Contact Connections router,Service set when can be dispatched from the factory using router and password carry out network connection.
First closing processing module 202, if for network connection failure, closes WPA_Supplicant process, and opensThe listening mode of dynamic intelligent terminal;
In the present embodiment, device 200 may also include work starting module 206;
Work starting module 206, if for network connection success, start the network connection work of intelligent terminal.Specifically, intelligent terminal can start DHCP (Dynamic Host ConfigurationProtocol, DHCP) service, dynamic IP address allocation.
When intelligent terminal enables listening mode, can constantly capture all of wireless data packet of surrounding.And work as intelligenceWhen energy terminal device starts WPA_Supplicant process, can be constantly trying to be connected with router.If intelligent terminalOpen listening mode and WPA_Supplicant process, intelligent terminal not only will capture and parse substantial amounts of no line number simultaneouslyAccording to bag, also to be constantly trying to be connected with router simultaneously, the performance of intelligent terminal so can be made to reduce.Especially in ringIn the case of the complexity of border, some wireless data packet are possible to not grab, or do not capture completely, or have not parsedEntirely, therefore intelligent terminal can constantly packet capturing simultaneously, unpacking, this process of connection route device, so can make intelligent terminalThe resource overhead of equipment becomes very big, and then leads to the collapse of the wireless network card of intelligent terminal.
Therefore, start before listening mode is captured and parsed wireless data packet it is necessary to close in intelligent terminalClose WPA_Supplicant process, stop being attached with router;When the service set getting router and password itAfterwards, close listening mode, start WPA_Supplicant process, connection route device.So intelligent terminal could be reduced noThe expense of gauze card, and make full use of the resource of wireless network card, the mode finally realizing timesharing completes to obtain the service of routerSet identifier and password and startup WPA_Supplicant process connection route device.
Crawl parsing module 203, for capturing and parsing wireless data packet;
In the present embodiment, crawl parsing module 203 includes placement unit 2031, confirms resolution unit 2032;
Placement unit 2031, for capturing wireless data packet;
Confirm resolution unit 2032, be used for being confirmed whether to grab wireless data packet;If grabbing wireless data packet, solveAnalyse this wireless data packet;Otherwise generate and enable signal to placement unit 2031.
In the present embodiment, the wireless data packet that wireless data packet can send for mobile terminal.
Confirm module 204, for being confirmed whether to get the service set of router and password, if getting routerService set and password, then generate enable signal give second close processing module 205;Otherwise generate and enable signal to crawlParsing module 203;
Second closing processing module 205, for according to the described enable signal confirming that module generates, updating default routeThe service set of device and password, close the listening mode of intelligent terminal, and generate enable signal to startup processing module201.
Intelligent terminal provided in an embodiment of the present invention accesses the device of internet, by first closing WPA_Supplicant process, starts listening mode and captures and parse wireless data packet, get the service set of router and closeClose Monitor pattern after code, then start WPA_Supplicant process, connection route device.Solve intelligent terminalCapture and parsing mass data bag while be constantly trying to be connected with router when, the intelligent terminal leading to wirelessNetwork interface card crash issue.Achieve the effect that intelligent terminal safely and steadly accesses internet.
It should be noted that herein, term " inclusion ", "comprising" or its any other variant are intended to non-rowThe comprising of his property, so that including a series of process of key elements, method, article or device not only include those key elements, andAnd also include other key elements of being not expressly set out, or also include intrinsic for this process, method, article or device instituteKey element.In the absence of more restrictions, the key element being limited by sentence "including a ..." is it is not excluded that including being somebody's turn to doAlso there is other identical element in the process of key element, method, article or device.
These are only the preferred embodiments of the present invention, not thereby limit the present invention the scope of the claims, every using thisEquivalent structure or equivalent flow conversion that bright specification and accompanying drawing content are made, or directly or indirectly it is used in other related skillsArt field, is included within the scope of the present invention.